0

我只是想向我的网站添加一个常规字体系列,但 IE8 不会显示它。它只显示其默认的 Times New Roman。这是我的 CSS:

body {
font-family: Arial, Helvetica, sans-serif;
}

这在 IE7、9 以及显然 Chrome 和 Firefox 上看起来不错,但我不确定为什么 IE8 会出现问题?

我的文档类型是:

<!DOCTYPE HTML>

我真的坚持这一点。这么简单的事情,我不知道为什么 IE8 不喜欢它。任何帮助将不胜感激。

谢谢,朱莉

4

1 回答 1

1

I had the exact same problem that was driving me nuts!

Ok, so my scenario was running Drupal 7, with bootstrap and using html5shim.js and respond.js to support media queries etc in ie8

One requirement of this setup is that css aggregation needs to be disabled for Respond to work correctly... Also with bootstrap it is very possible to exceed ie8's 4096 selector limit, so I took care to disable certain components to make sure that I came in under this!

So my problem was that once css aggregation was enabled, despite showing in ie8's (excuse for an) inspector, it always seemed to revert to times new roman, ie8 and other browsers default font!? Disable either respond or css aggregation, and everything works as expected, including the right fonts in ie 8!!!

Ok, so it turns out as mentioned by Julie previously, when I remove font: inherit from the meyer reset, everything seems to work as normal. This is counter intuitive as you would expect css to cascade, and any later values should override an earlier declared one. Also why does font: inherit cause ie8 to ignore fonts even if they are declared later?

So the fix here seems to be to remove font: inherit (which I thought was how css worked anyway), and enable css aggregation and see respond working as expected in ie8!?

于 2014-09-11T19:56:23.883 回答