【问题标题】:font-face working in chrome but not in firefox and iefont-face 在 chrome 中工作,但在 Firefox 和 ie 中没有
【发布时间】:2015-03-13 20:52:51
【问题描述】:

我认为标题已经说明了我的问题。

这是我的代码,希望你能说出我做错了什么:

@font-face {
  font-family: 'Deer';
  src: url('fonts/Deer.eot') format('embedded-opentype');
  src: url('fonts/Deer.woff') format('woff'),
       url('fonts/Deer.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

IE 正在下载 ttf 和 woff 文件,但不下载 eot,firefox 没有下载它们...

【问题讨论】:

  • 它应该可以工作...也许您的 woff 文件已损坏或位于错误的位置?查看谷歌字体示例:fonts.googleapis.com/css?family=Open+Sans 或者您安装了 noscript? noscript 会阻止 google 字体,只需查看 noscript 图标即可。 edit 我认为你的语法错误
  • 如果我删除了除 woff 文件之外的所有内容,它仍在 chrome 中工作

标签: css internet-explorer firefox font-face


【解决方案1】:

试试

@font-face {
  font-family: 'Deer';
  font-weight: normal;
  font-style: normal;
  src: url('fonts/Deer.woff') format('woff'),
       url('fonts/Deer.eot') format('eot'),
       url('fonts/Deer.ttf') format('ttf');
}

我认为@font-face 中不允许有超过 1 个src-argument。

【讨论】:

  • 再试一次,我更改了格式描述符和字体顺序
  • 您究竟是从哪里获得“Deer.woff”文件的?我只能在 dafont.com 上找到 Deer.ttf。你自己转换的吗?
  • 是的,我转换了它(使用font2web.com),但 woff 文件似乎可以工作,因为如果我删除其他文件并在 chrome 中尝试它,它仍然可以工作
  • 我刚刚使用 onlinefontconverter.com 进行了转换,它正在使用上述代码在 Firefox 中工作。看这里:blim-dev.com
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-02-15
  • 2012-05-26
  • 2013-10-16
  • 1970-01-01
  • 2011-12-17
  • 2011-02-20
  • 2017-07-21
相关资源
最近更新 更多