在我的jQuery mobile应用程序中,我想使用自定义字体系列,我已经厌倦了以下代码,但是它没有用。如何在jQuery mobile中使用自定义字体文件?
请帮我
的CSS
@font-face{
font-family:'Roboto-Light';
src: url("Fonts/Roboto-Light.ttf");
}
font {
text-shadow:0 0 0;
-moz-user-select: none;
-webkit-user-select: none;
font-family: "Roboto-Light" !important;
}
定义Roboto字体系列后,必须将其用作页面上的默认字体:
body, .ui-btn {
font-family: Roboto-Light;
}
确保您的路径Fonts/Roboto-Light.ttf
正确。
如果您将连接到互联网,也可以使用Google字体,请将此行放入CSS中:
@import url(http://fonts.googleapis.com/css?family=Roboto:400,300,500,700);
另外,对于更跨浏览器的解决方案,您可以获取eot,woff和svg版本的字体以及ttf,然后定义新的字体,如下所示:
@font-face {
font-family: 'roboto';
src: url('fonts/roboto-regular-webfont.eot');
src: url('fonts/roboto-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/roboto-regular-webfont.woff') format('woff'),
url('fonts/roboto-regular-webfont.ttf') format('truetype'),
url('fonts/roboto-regular-webfont.svg#robotoregular') format('svg');
font-weight: 400;
font-style: normal;
}
这是一个使用谷歌字体的演示
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句