Does IE 8 have a limit on number of stylesheets per page?

前端 未结 6 1006
借酒劲吻你
借酒劲吻你 2020-11-27 18:07

In an answer about CSS, a user said:

Internet Explorer has is said to have a limit of 4096 CSS rules per file. Reference

相关标签:
6条回答
  • 2020-11-27 18:14

    This thread suggests there is a limit of 31 CSS references per page/CSS file but that you can achieve more than that by using @import and a nested hierarchy of CSS files.

    More info from a Telerik blog on the issue making it clearer that this applies to IE8.

    0 讨论(0)
  • 2020-11-27 18:14

    I was building a site and hit this issue myself. It was driving me batty until a co-worker pointed this 31 CSS files issue out. Looking into it what struck me that it's more complicated than that because IE8 seemed to be loading some of the styles from the sheet but not all of them. It was ignoring media queries and chained classes just like it was behaving in Quirks mode — even though it wasn't in Quirks mode and both those were in the same CSS file as other CSS that was being used. Once I aggregated the CSS files into one file it all worked fine. Anyway I just wanted to point out that somehow this 31 limit also seems to trigger something like Quirks mode.

    0 讨论(0)
  • 2020-11-27 18:17

    Thanks to the above testing script I have just confirmed this limitation (apparently 30) still exists even in Internet Explorer 9!

    0 讨论(0)
  • 2020-11-27 18:30

    Yes, IE8 (and even IE9 apparently) limit the number of style sheets to 31 per page.

    Telerik has an article and test page which demonstrate the issue. According to comments in the same article, the 4096 rules per file limitation has been marked as Won't Fix in Microsoft Connect but I've been unable to verify that.

    0 讨论(0)
  • 2020-11-27 18:31

    Microsoft claims the limit is 30, but the limit is apparently 31 according to Telerik. The Telerik blog also mentions a 4095 selectors per file limit.

    0 讨论(0)
  • 2020-11-27 18:39

    If you use NPM get Bless installed it sorts out the problem for you

    0 讨论(0)
提交回复
热议问题