Internet Explorer 的 CSS 规则限制 [英] Internet Explorer's CSS rules limits
问题描述
我读过有关 Internet Explorer 愚蠢的 CSS 限制的相互矛盾的信息.我(认为我)理解你只能有 31 个 和
标签(组合),并且每张纸最多可以有31
@import
-s(所以 31 -s,每个到 31
@import
-s 都很好,虽然很疯狂).
I've read conflicting information regarding Internet Explorer's silly CSS limits. I am (think I am) understanding that you can only have 31 <style>
and <link>
tags (combined), and that each sheet can have up to 31 @import
-s (so 31 <link>
-s, each to 31 @import
-s is fine, albeit insane).
但是,4095 规则不太清楚——这是每份文档还是每张纸 4095 条规则?例如,我可以到两个样式表,每个样式表都有 4000 条规则,然后让它工作,还是会突破限制?
However, the 4095 rule is less clear - is this 4095 rules per document, or per sheet? For instance, can I <link>
to two stylesheets, each with 4000 rules, and have it work, or will this break the limit?
在这个 msdn 博客文章中stylesheet-limits-in-internet-explorer 提供了更多信息.
On this msdn blog post stylesheet-limits-in-internet-explorer further information is given.
推荐答案
参考 Microsoft 的以下内容:
Referring the following from Microsoft:
IE9 的规则是:
- 一个工作表最多可包含 4095 个选择器(演示)一个>
- 一个sheet最多可以@import 31张
- @import 嵌套最多支持 4 层深度
- A sheet may contain up to 4095 selectors (Demo)
- A sheet may @import up to 31 sheets
- @import nesting supports up to 4 levels deep
IE10 的规则是:
- 一个工作表最多可以包含 65534 个选择器
- 一个sheet最多可以@import 4095张
- @import 嵌套最多支持 4095 级深度
- A sheet may contain up to 65534 selectors
- A sheet may @import up to 4095 sheets
- @import nesting supports up to 4095 levels deep
按图纸限制测试 4095 规则
作为确认,我已经创建了一个包含 3 个文件的要点.一个 HTML 和两个 CSS 文件.
By way of confirmation, I've created a gist with 3 files. One HTML, and two CSS files.
- 第一个文件包含 4096 个选择器,这意味着它的最后一个选择器不会被读入.
- 第二个文件 (4095.css) 少了一个选择器,可以读入,并在 IE 中完美运行(即使它已经从前一个文件中读取了另一个 4095 选择器.
这篇关于Internet Explorer 的 CSS 规则限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!