且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

IE8中没有加载CSS样式

更新时间:2022-02-07 22:16:10

@Guffa把我带到了正确的轨道上:问题在于HTML5元素无法在Internet Explorer 8及更低版本中运行。

@Guffa put me onto the right track with this: the problem is that the HTML5 elements aren't working in Internet Explorer 8 and lower.

Modernizr 解决此问题,但是: http://www.modernizr.com/docs/#installing

Modernizr would fix this, but: http://www.modernizr.com/docs/#installing


删除HTML中
< head> 中的脚本标记。
为了获得***性能,您需要
它们跟随你的
样式表引用。我们
建议将Modernizr置于
头部的原因有两个: HTML5 Shiv(
启用IE中的HTML5元素)必须在之前执行c $ c>< body>
,如果
你使用的是Modernizr添加的任何CSS类
,你需要
阻止FOUC。

Drop the script tags in the <head> of your HTML. For best performance, you should have them follow after your stylesheet references. The reason we recommend placing Modernizr in the head is two-fold: the HTML5 Shiv (that enables HTML5 elements in IE) must execute before the <body>, and if you’re using any of the CSS classes that Modernizr adds, you’ll want to prevent a FOUC.

因此,您只需要在< / body&gt之前移动Modernizr ; < head> 元素内。

So, you simply need to move Modernizr from just before </body> to inside the <head> element.