【发布时间】:2012-08-09 17:24:01
【问题描述】:
所以 IE9 在使用 google 字体时会报错,如下所示:
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet" type="text/css" />
IE9 吐出一个错误,即使字体仍然可以正常加载:
CSS3111: @font-face encountered unknown error.
如果我不是在其他人的网页上编写 iframe 的内容,我很乐意忽略此错误。 :(
在本地托管 EOT 文件可以解决 IE 的问题:
< !--[if IE 9]>
< link rel="stylesheet" href="/survey/css/lato-ie.css" type="text/css" />
< ![endif]-->
在那个文件里..
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 400;
src: url("/Lato-Reg-webfont.eot") format("embedded-opentype");
}
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 900;
src: url("/Lato-Bla-webfont.eot") format("embedded-opentype");
}
将它包含在 IE9 中,错误消失了,效果很好。
现在我的问题是,我需要为除 IE9 之外的所有人添加 google 字体样式表。例如,我不能这样做:
< !--[if !IE 9]>
< link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet" type="text/css" />
< ![endif]-->
否则 Firefox 甚至不会看到该死的包含。
IE 的开发者是否在密谋浪费我们所有的时间?
【问题讨论】:
-
托管所有浏览器的字体是否有很大的劣势?
-
除了努力和可扩展性之外别无其他(我将需要为我无法保证获得 .woff、.ttf 和 .svg 的字体执行此操作,让单独.eot)..
标签: css internet-explorer-9 font-face