IE 7 and IE 8 Impose 31 CSS File Limit - Drupal Beware!

While debugging a client's site this weekend, I came across a rather dumbfounding issue. The site would look great in Firefox, but not in IE. In fact, IE seemingly ignored any CSS statements I would add to layout.css (part of a Zen-based custom theme).

If we look at the page source, Zen likes to add on a considerable number of CSS files along with several contributed modules -- over 40 CSS files total!

After TWO HOURS of continuous, verbal "WTFs," my partner, Chris, suggested that IE was perhaps reaching some kind of CSS file limit since he couldn't see some of the files listed when debugging in IE 8. Sure enough, IE 7 and IE 8 were reaching their 31 CSS file limit!

http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/ad...

The fix, in our case, was to turn on CSS caching so that there was only 1 CSS file being added. Microsoft suggests including the CSS files across different HTML/PHP files, but with core Drupal, page.tpl.php is the only option from which to include CSS.

Now that's just ridiculous.

31 seems like a low limit for

31 seems like a low limit for IE (they normally allow you to do lots of things like this) but you really should only have a handful of files.

Every file slows down your website a little bit. With more people having broadband connections these days people are moving towards CSS sprites and cramming as much in one file as possible to speed up their sites.

While that is correct, you

While that is correct, you should think that microsoft should recommend, not impose, having a limit of CSS files we should handle. But I think the limit was because IE is so buggy that it couldnt handle more than 32 CSS files. Take that microsoft

Whew, thanks for posting

Whew, thanks for posting this. I followed the same
path, Drupal Zen and all, and am glad to have my
suspicions confirmed.

And I think developing/testing with many
independent css files is a GOOD idea, should be
encouraged not made impossible. Consolidate them
when they work, of course.

awesome article and tutorial.

awesome article and tutorial. it increased my knowledge, specifically i didn't know about the drupal part

IE sucks. As a developer, I

IE sucks. As a developer, I like Chrome and Firefox better.
-Harv Ecker

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h1> <h2> <h3> <h4> <h5> <h6> <img>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.

More information about formatting options