<< View The Archive

IE Stylesheet Limit

Internet Explorer nearly caused me to give up on the interwebnetz forever today. For simplicities sake, I like to create page-specific stylesheets. It helps me quickly find chunks of CSS and organize things. Today I *could not* get a stylesheet to work in the devil browser. After three hours of troubleshooting, I figured out that IE was not rendering the last included stylesheet. A quick Google search brought to my attention the 31 stylesheet limit in IE 6 & 7. Has anybody else heard of this? It's new to me!

by Keegan on March 28, 2008

14 Comments

Don't you know that loading 31 stylesheets requires a server request for each stylesheet — even if they're cached? That's like 30 requests per page too many. I can't imagine how peeved the person who pays your site's server bill must be.

Wait. I pay that bill.

Josh Williams

28 Mar 08 at 5:15pm

lolcats funny cat pictures

28 Mar 08 at 5:21pm

Huh, I didn't know stylesheets required a server request every time either.

Travis Willis

28 Mar 08 at 6:55pm

Keegy! Wut's up wit dat!? By George! I think you have discovered something…

Just do like I do and have well defined sections… (i just know it's gonna strip everything I write from here on…)

/* global styles */ body {} a {} etc…

/* ——- page specific styles */ /* home page */ bla bla

/* contact page */ bla bla

…actually, I've taken to putting my styles all on one line, if you have a syntax highlighting editor this is a lot more neat looking and tidy than it sounds.

EXAMPLE: http://www.weashuman.com/weashuman/css/grid.css

You can see that I use a similar tabbing that correlates to the HTML..so it all makes sense. For instance, if I wanted to edit some span I have in my nav somewhere, I simply jump to nav and my eyes can quickly find the style ref I'm looking for without having to scroll down for days. I find this to be an insane time saver.

It takes a bit to get used too, but I'm a believer. Let me know if that helps.

Aaron Harlow

28 Mar 08 at 7:29pm

Is it April Fool's already or are you a little early?

I run with something a lot like what Aaron is suggesting. And I definitely do all the funky formatting. It takes some getting used to initially, but then it just feels clean and sexy smooth!

Lachlan Hardy

28 Mar 08 at 7:58pm

Never heard of it.

Shane Guymon

28 Mar 08 at 9:55pm

I believe the import workaround should solve your problem. But @ 31+ stylesheets I think it's time to rethink your methods.

Jacques Sartre

30 Mar 08 at 8:05pm

You could try to include your stylesheets via php in the <head> and load the necessary one via Switch Case Method.

Matt St. Gelais

31 Mar 08 at 10:38am

Thanks for the tips, everyone!

@Aaron – I dig that CSS formatting. I'll have to give it a try!

@doctor – The import trick works great for development. For the live app, we are going to roll all the stylesheets into one.

31 Mar 08 at 10:57am

you should really be combining CSS files wherever you can, that is a lot of unessesary HTTP connections that are bad for website performance

http://stevesouders.com/hpws/rule-min-http.php

milkman

31 Mar 08 at 3:41pm

The most style sheets I've ever used was three. I feel very small right now. :(

Addison Kowalski

31 Mar 08 at 5:49pm

Ha ha…31 stylesheets! You must be a n00b.

Michael Jackson

1 Apr 08 at 4:13pm

I find that having CSS in different files helps to keep different styles, usually related to specific objects or visual elements, more organized. This also makes it easier to maintain – especially for very large projects.

In order to keep the number of server requests down, I concatenate the CSS files into one, for the live environment at compile time. This also allows me to do some preliminary rule checking on the CSS, remove comments, and generally make the CSS as small as possible.

Remember also – IE not only limits the NUMBER of CSS files but also the SIZE of CSS files. I believe the limit is 288KB – but you might want to look that one up to be sure.

Why Micro$oft would impose such seemingly arbitrary limits like this is bizarre.

Theresa

7 Apr 08 at 3:30pm

I don't think that Microsoft put the limits for any reason other than it seemed like a large enough number and they had other things to do. It's biting me in the ass at the moment, but as a coder myself I understand when trade offs are made between designs and code that scales and meeting deadlines.

Alec

14 May 08 at 3:58pm

Post your comment

will never be made public

ex: http://totalgayness.com

Basic HTML is allowed. Please be mature. Posting vile or biggoted remarks will get you banned from commenting in the future. It's pretty simple: don't be a buttwipe.

The author

Keegan Jones is a designer living somewhere between Dallas and Fort Worth, Texas. He can make a tasty bowl of EasyMac, and loves sticking it to the man. After beating Guitar Hero on expert mode, he now acts like a rockstar. Things just haven't been the same since.

more...

Authentic Jobs

A list of recent openings at Authentic Jobs:

Post your job opening and reach designers everywhere

Popular Posts