I'm using Drupal and I notice that if I have my CSS files aggregated that the CSS doesn't always work correctly. I know there is a problem in IE7 but is there a limit to a CSS file size in IE9?
Asked
Active
Viewed 2.6k times
52
-
This is a vague question. What else can you tell us? – Cthulhu Jun 18 '12 at 10:02
-
2It seems that somebody else has had the same problem, please check http://stackoverflow.com/a/3212065/795876 – fsenart Jun 18 '12 at 10:03
-
@fsehat thanks for the link, that didn't come up in my previous searches unfortunately – Paul Sheldrake Jun 18 '12 at 10:12
1 Answers
103
There are 3 limits:
- a sheet may contain up to 4095 selectors, see http://demos.telerik.com/testcases/4095issues.html
- a sheet may @import up to 31 sheets, see http://demos.telerik.com/testcases/BrokenTheme.aspx
- @import nesting supports up to 4 levels deep
Microsoft support/MSDN reference links:

theDmi
- 17,546
- 6
- 71
- 138

Paul Sheldrake
- 7,505
- 10
- 38
- 50
-
17To notice, IE10 doesn't have this limit (including when in IE7-8-9 modes) – Evgenyt Dec 06 '12 at 14:24
-
11there's a ~288kb file max too. Info: http://joshua.perina.com/africa/gambia/fajara/post/internet-explorer-css-file-size-limit – RaphaelDDL May 24 '13 at 21:03
-
1@RaphaelDDL I don't think that link should be taken at face value. I regularly see larger files. The link author probably hit the selector limit. – noah Jul 03 '13 at 16:07
-
@noah I've had cases files around that size have failed while still being below the other limits. Splitting into multiple files fixed the problem so it's worth checking out. – Andrew Pietsch Jan 10 '14 at 11:05
-
1
-
I've seen other people mention the 278kb limit as well https://gist.github.com/psebborn/1885511#comment-1383451 – Daniel Apt Mar 12 '15 at 10:53
-
-
For a silly guess, I'm going to say anything greater than 256 (the 8th power of two) might be the limit. If the file was loaded into a single byte field, that might be the issue. The next size up is 1024.. I haven't seen anything there. – Josh Robinson Sep 22 '15 at 14:52
-
I could not find any evidence for a 288KB limit. See https://stackoverflow.com/questions/49683077/is-there-a-css-file-size-limit-in-ie9/49784811#49784811 – Arya Apr 11 '18 at 21:41