Internet Explorer 31-stylesheet limit
After half an hour of editing ie6.css
and wondering why the heck my customizations weren't actually showing up in MSIE, I came across a bit of CSS trivia that I'd forgotten, if I ever knew it at all: Internet Explorer can only load 31 stylesheets. Maybe this is due to the stylesheets being indexed by a 5-bit number? I can't imagine a logical reason for such an arbitrary limit. Anyhow, a quick glance at the page source revealed that ie6.css
was number 33, which explained why my customizations weren't finding a foothold.
Drupal has a CSS optimization feature that supposedly can help with this, but it's kind of annoying to do style developments with that turned on. The real problem here is the tradition that many Drupal themes have of including a ton of different CSS files; one for layout, one for background images, one for blocks, one for forms, one for fields, and so on. My theme is based on Zen, which alone includes 17 different stylesheets. Add to that the various stylesheets that are builtin to the custom modules I've installed, and we quickly exceed that 5-bit limit.
The solution was simple--just edit my theme's .info
file and comment out all the styleshets that are totally empty (views-styles.css
, panels-styles.css
), logically empty or very close to it (page-backgrounds.css
, fields.css
, blocks.css
) or otherwise unused (wireframes.css
). I'm not sure why these void stylesheets aren't commented out by default in the starterkit theme; I can't imagine many theme developers actually needing them, and if you know you need to define a custom style for #block-aggregator-category-1
, you're probably smart enough to uncomment the relevant line in your .info
file.
A couple of bugs have been opened for this, but it's good to have an easy workaround in the meantime.