IE8中没有加载CSS样式 [英] CSS styles not being loaded in IE8
问题描述
我有一个非常奇怪的问题,IE8中没有加载CSS样式(也许IE7也可以检查)。我的网站位于 http://www.leavetrackapp.com/ ,我的主CSS文件如下:
I have a very strange issue in that no CSS styles are being loaded in IE8 (maybe IE7 as well but cannot check). My site is at http://www.leavetrackapp.com/ and my master CSS file is as follows:
@import url("reset.css");
@import url("screen.css");
@import url("site.css");
@import url("colorbox.css");
如果我直接在浏览器中输入地址,则可以访问master.css文件和indidivual样式表。 http://www.leavetrackapp.com/stylesheets/master.css 返回主文件。
The master.css file and indidivual stylesheets are accessible if I directly enter the address in the browser e.g. http://www.leavetrackapp.com/stylesheets/master.css returns the main file.
我认为这是导入规则的问题,但不知道它可能是什么。 Safari和Firefox工作正常。
I think it's a problem with the import rules but have no idea what it could be. Safari and Firefox work fine.
任何建议都值得赞赏。
谢谢
Robin
推荐答案
@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>之前移动Modernizr ;
到< head>
元素内。
So, you simply need to move Modernizr from just before </body>
to inside the <head>
element.
这篇关于IE8中没有加载CSS样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!