我有 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;
}
还在 OutputText as styleClass="UX_FontClass "
中提到了 XHTML
即使字体在任何浏览器中都不起作用。我的代码做错了什么?或者我错过了什么?
最佳答案
你应该使用谷歌字体,它真的很容易使用。
https://www.google.com/fonts#UsePlace:use/Collection:Robot
例子
<head>
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
</head>
<body>
<p style="font-family: 'Roboto', sans-serif;">Hello World</p>
</body>
关于css - roboto 字体在 css 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30074051/