【问题标题】:Lato font broken in FirefoxFirefox 中的 Lato 字体损坏
【发布时间】:2015-09-18 11:08:48
【问题描述】:

我使用 Lato Google 字体开发了一个网站。 Chrome 一切正常,但当我使用 Firefox 时,字体坏了,我得到的是 Times New Roman 字体。

奇怪的是,当我打开 https://www.google.com/fonts/specimen/Lato 时,我确实得到了 Lato 字体。所以我的猜测是我的代码有问题。

网站是http://www.okaprix.com/ 这是我为使用 Lato 字体编写的 CSS 代码:

/* latin-ext */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  src: local('Lato Regular'), local('Lato-Regular'), url(http://fonts.gstatic.com/s/lato/v11/UyBMtLsHKBKXelqf4x7VRQ.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  src: local('Lato Regular'), local('Lato-Regular'), url(http://fonts.gstatic.com/s/lato/v11/1YwB1sO8YE1Lyjf12WNiUA.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
body {
font-family : Lato;
margin : 0 auto;
height : 100%;
font-size: 16px;
min-width:1066px;
}

【问题讨论】:

标签: html css firefox fonts


【解决方案1】:

这不是您实现 Google 字体的方式。在页面的head 中使用以下标记:

<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>

然后只需在样式表中指定 Lato。

【讨论】:

  • 如果你打开那个链接 (fonts.googleapis.com/css?family=Lato) 你会发现那只是一个带有我写的代码的 CSS 文件。
  • 我想您会发现问题在于您不能直接从您的站点调用 .woff 文件 - 您必须改为加载 Google 的样式表。
  • 好的。这似乎是问题所在。谢谢!
猜你喜欢
  • 2014-10-15
  • 1970-01-01
  • 2015-10-05
  • 1970-01-01
  • 2016-07-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多