Body Classes Instead of Conditional Stylesheets

I’m thinking I should create a, ‘Duh, why didn’t I think of that?’ category for this. Instead of using conditional stylesheets or CSS hacks to fix Internet Explorer’s obnoxious lack of support for standards, you can conditionally set a class on the html or body tag and target that in your normal stylesheet. This is better for several reasons, including faster page load times and better organization/maintainability.

Of course, as Louis Lazaris points out, it’s even better if you just massage your regular styles a bit to make them work in all the modern browsers — which, in my experience, usually isn’t too hateful.

Leave a Reply

Your email address will not be published. Required fields are marked *