【问题标题】:CSS Not Rendering Completely in IE9CSS 在 IE9 中没有完全呈现
【发布时间】:2015-08-31 23:26:25
【问题描述】:

我使用 WordPress 和 Foundation 5 构建了一个站点。它在现代浏览器中呈现良好,但客户端需要它在 IE9 中运行。我正在使用运行 Windows 7 的 Windows 虚拟机在 IE9 中对其进行测试,并且该站点未完全或正确加载 CSS,并且仅识别了一些规则,通常是规则的第一个实例,而没有后续实例.

我已经尝试过的事情

  • 我有一个文档类型声明
  • 我已将<meta http-equiv="X-UA-Compatible" content="IE=edge" /> 首先包含在我的标题中
  • 在我的 jQuery 中双重检查流浪 console.log
  • 我的 CSS 中的选择器少于 4096 个
  • 我已经在关闭所有插件并删除脚本的情况下进行了测试
  • 我已经修复了所有的 HTML 验证错误

暂存站点:http://sytycw.pixelsmithdesign.com

任何帮助将不胜感激。

编辑:正如 justbeez 在下面指出的那样,一旦我计算了倍数,我确实有超过 4095 个选择器。

【问题讨论】:

  • 样式表是被解释为 CSS 还是纯文本?

标签: css wordpress internet-explorer-9 zurb-foundation-5


【解决方案1】:

您实际上超过了以下文件的 4095 选择器限制: http://sytycw.pixelsmithdesign.com/wp-content/themes/sytycw_2015/css/foundation.css

这里与您的计数不同的是,您需要在 @media 声明中包含嵌套级别的规则。

krisbulman 有一个简单的计数脚本版本,您可以在 DevTools 中运行它来获取计数(我会在 Chrome 中运行它,这样您就会收到警告;如果没有,它只会显示 4095): https://gist.github.com/krisbulman/0f5e27bba375b151515d

我对您发布的 URL 的输出如下:

File: inline <style> tag
Rules: 1
Selectors: 1
--------------------------
File: http://sytycw.pixelsmithdesign.com/wp-content/plugins/candidate-voting/resources/frontend/candidate-voting.css
Rules: 6
Selectors: 6
--------------------------
File: http://sytycw.pixelsmithdesign.com/wp-content/plugins/revslider-5.0/public/assets/css/settings.css
Rules: 220
Selectors: 303
--------------------------
File: inline <style> tag
Rules: 9
Selectors: 12
--------------------------
File: http://sytycw.pixelsmithdesign.com/wp-content/themes/sytycw_2015/css/foundation.css
Rules: 1776
Selectors: 4419
--------------------------
File: http://sytycw.pixelsmithdesign.com/wp-content/plugins/sytycw-manuscripts-1.0.5.1/resources/frontend/sytycw-manuscripts.css
Rules: 1
Selectors: 1
--------------------------
File: inline <style> tag
Rules: 1
Selectors: 1
--------------------------
VM1068:39 
********************************
WARNING:
There are 4419 CSS rules in the stylesheet http://sytycw.pixelsmithdesign.com/wp-content/themes/sytycw_2015/css/foundation.css - IE will ignore the last 323 rules!

您可以通过添加一个拆分一半规则的新样式表来轻松测试这一点(我个人只是在 IE 的开发工具中添加了一个带有最后一条规则的样式块,并看到一切都到位)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-04-07
    • 2012-11-21
    • 1970-01-01
    • 2012-12-28
    • 1970-01-01
    • 1970-01-01
    • 2021-10-01
    • 2014-11-15
    相关资源
    最近更新 更多