css - roboto 字体在 css 中不起作用

标签 css xhtml font-face webfonts google-webfonts

我有 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/

相关文章:

css - 如何在ASP.NET网页中设置div的背景颜色

html - 覆盖 slider 背景的 CSS 值

javascript - 如何更改 Bootstrap 3 导航栏中事件选项卡的背景颜色?

java - 在 RichFaces 中,使用电子邮件验证时我收到 NullPointer 异常?

html - 特定 id 的 css 样式未按预期工作

css - 如何在 Internet Explorer 中执行 @font-face 抗锯齿?

security - Google 如何通过新的 Webfonts 服务绕过 Firefox 中的跨站点字体使用安全?

html - Bootstrap 在中断后删除同一行中列之间的空格

css - 有人知道离线验证 XHTML/CSS 的好工具吗?

css - FontFace 中字体的不同版本