我有CSS和XHTML文件。我已经下载了所有ROBOTO字体并将其放在“ webapps / fonts /”文件夹中。
在我的XHTML中,我提到了CSS路径,
'<link href="../css/tab_ux.css" rel="stylesheet" type="text/css" />'
而且我的CSS文件的样式如下:
@font-face {
font-family:roboto-bold;
src: url('../fonts/Roboto-Bold.tff') @ttf;
}
.UX_FontClass {
font-family: roboto-bolditalic !important;
font-size : 25px !important;
}
还提到了XHTML OutputText as styleClass="UX_FontClass "
即使字体在任何浏览器中都不起作用。我的代码做错了什么?还是我错过了什么?
您正在使用自定义字体,因此还需要添加一些字体类型格式。像ttf
,eot
并svg
为iPhone,iPad设备。
注意:某些浏览器支持不同的字体类型,这就是为什么你需要
ttf
,svg
或eot
。
@font-face {
font-family: 'Roboto';
src: url('Roboto-ThinItalic-webfont.eot');
src: url('Roboto-ThinItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('Roboto-ThinItalic-webfont.woff') format('woff'),
url('Roboto-ThinItalic-webfont.ttf') format('truetype'),
url('Roboto-ThinItalic-webfont.svg#RobotoThinItalic') format('svg'); (under the Apache Software License).
font-weight: 200;
font-style: italic;
}
记住之后,您需要在类中添加此代码 UX_FontClass
.UX_FontClass {font-family: 'Roboto', Arial, Helevtica, sans-serif; }
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句