【问题标题】:@Font-face problems in IE and fontsquirrel fixIE 中的@Font-face 问题和 fontsquirrel 修复
【发布时间】:2013-05-27 11:24:42
【问题描述】:

我能够在 chrome 和 Firefox 中成功使用 @font-face,但在 IE 中却没有:

font-family: 'Market_Deco';

src: url('fonts/Market_Deco.ttf');

这在IE中不起作用,所以我尝试在转换并添加EOT文件后添加这一行:

src: url('fonts/Market_Deco.eot') format ('eot');

这仍然不起作用,所以我删除了 .ttf 引用并只使用了 EOT 行。这在 IE 中修复它并在其他任何地方破坏它。我开始看这里,每个人都推荐字体松鼠,所以我尝试了:

@font-face {
font-family: 'market_decoregular';
src: url('fonts/market_deco-webfont.eot');
src: url('fonts/market_deco-webfont.eot?#iefix') format('embedded-opentype'),
url('font/market_deco-webfont.woff') format('woff'),
url('fonts/market_deco-webfont.ttf') format('truetype'),
url('fonts/fontmarket_deco-webfont.svg#market_decoregular') format('svg');
font-weight: normal;
font-style: normal;
}

我将四个新字体文件添加到我的字体文件夹中,更新了 CSS,现在它可以在零个浏览器中使用。我在这里遗漏了什么吗?

【问题讨论】:

  • url('font/market_deco-webfont.woff') format('woff'), 为什么这一行使用“font”而不是“fonts”?
  • 呃——这就是答案。

标签: html css fonts


【解决方案1】:

如果您在样式表中将该字体称为

font-family: 'Market_Deco';

那么它不会调用字体,因为它实际上在你的字体规则中被称为 market_decoregular:

@font-face {
font-family: 'market_decoregular';

如前所述,

url('font/market_deco-webfont.woff') format('woff'),

应该是

url('fonts/market_deco-webfont.woff') format('woff'),

【讨论】:

  • Font Squirrel 自动重命名它。两个名字都是正确的。一个版本的字体文件夹破坏了整个过程。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-01
  • 2012-08-26
  • 2011-04-03
  • 2015-11-29
  • 1970-01-01
相关资源
最近更新 更多