我基于 Paul Irish 的 bulletproof @font-face 语法,将以下 CSS 代码用于自定义字体:
@font-face {
font-family: 'TradeGothic';
src: url('tradegothiclt.eot');
src: local('☺'),
url('tradegothiclt.otf') format('otf'),
url('tradegothiclt.ttf') format('truetype');
}
出于某种原因,这在 Firefox、Chrome 和 IE7 中完美运行,但在 IE 8/9 中不起作用。任何想法为什么会这样?我尝试过其他字体方法,每次都得到相同的结果。我不知道它是否相关,但这是通过安装 Wordpress 完成的。
最佳答案
将 @font-face
规则移出 @media
规则。
通过 general CSS syntax , at 规则可能只出现在样式表的顶层,而不是嵌套在另一个 at 规则中。 IE 9 似乎强制执行此操作,您也可以使用 W3C CSS Validator 检查此操作(嵌套 at 规则时会给出模糊的错误消息“解析错误”)。
关于css - @font-face 在 IE8/9 中不工作,但在 IE7 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14132097/