4

I help manage a website for a local ACM student chapter, http://acm.cs.uakron.edu/.

For some reason, Internet Explorer simply refuses to parse the majority of the CSS. Every other browser I know of handles it just fine, but why does IE7+ stop?

  • 2
    Define "refuses to parse" and include the CSS (or a convenience link to it) to get (better) answers. –  Oct 12 '10 at 19:38
  • Which CSS file are you talking about? There's about three dozen stylesheets on the page that you linked to. – casablanca Oct 12 '10 at 19:39
  • It appears there are 35 separate CSS files included on that page (which is rather horrifying, by the way - consider a compile stage that combines them). Are you having problems with one in particular? Have you made certain there are no syntax errors in the file? – JAL Oct 12 '10 at 19:40
  • More information: http://stackoverflow.com/questions/3211991/does-ie-8-have-a-limit-on-number-of-stylesheets-per-page – Gary Willoughby Oct 19 '10 at 07:55

2 Answers2

10

The comments say you have 35 CSS files. That in itself, in addition to just being a lot of requests, is enough to be a showstopper for IE.

According to Microsoft Knowledge Base Article 262161,

All style tags after the first 31 style tags are not applied.

This applies to all versions of IE so far, including the IE9 beta. Ouch. Time to merge those stylesheets into one file.

When handling big complex CSS projects like that, I usually recommend using a CSS pre-processor like Sass, and turning those smaller stylesheets into includes pulled into the larger stylesheet that is fed to the browser. Almost everyone has a different solution to this particular issue, though.

Matchu
  • 83,922
  • 18
  • 153
  • 160
  • 5
    It's amazing how IE can impose such arbitrary limits in the most unsuspecting of places. – casablanca Oct 12 '10 at 20:02
  • 1
    To be honest, if you have to make 35 different HTTP requests just for one page's CSS you _are_ doing it wrong. – badp Oct 12 '10 at 20:16
  • 1
    @badp: Yeah, it's not a great thing for a website to be doing, but it's also odd for a browser to simply refuse to handle something and not even error out. – Matchu Oct 12 '10 at 20:18
4

Internet Explorer can not parse any more than 31 CSS files wether embedded or not. Even if you use the @import css syntax IE will ignore everything after 31 files! How crap is that?

try http://sourceforge.net/projects/cssmerge/

Gary Willoughby
  • 50,926
  • 41
  • 133
  • 199