Internet Explorer的CSS规则限制 [英] Internet Explorer's CSS rules limits
问题描述
我读过关于Internet Explorer的愚蠢CSS限制的冲突信息。我认为您只能拥有31个< style>
和< link>
(组合),每张表最多可以有31个 @import
-s(因此31 < link>
-s,each to 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规则每个文档,还是每张?例如,我可以< link>
到两个样式表,每个有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?
感谢
推荐答案
从Microsoft引用以下内容:
Referring the following from Microsoft:
- Stylesheet Limits in Internet Explorer
- KB - A webpage that uses CSS styles does not render correctly in Internet Explorer
IE9的规则是:
- 一个表格最多可包含4095个选择器(演示)
-
- 最多可汇入31张图片
- @import nesting最多支援4层深度 b $ b
- 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
按照工作表限制测试4095规则
确认,我创建了一个有3个文件的gist 。一个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屋!