The history of CSS hacks
Tantek Çelik’s post Pandora’s Box (Model) of CSS Hacks And Other Good Intentions recaptures the history of CSS hacks and filters. In the early days CSS filters were used mainly to completely hide stylesheets from obsolete browsers like Netscape 4. However, once a way of sending one value to Internet Explorer 5.x for Windows and another to browsers that support the W3C box model was discovered, things changed:
Once said Pandora’s Box was opened, it didn’t take long for the notion that hacking CSS was a “good idea” to spread far and wide in the web design and development community
Tantek goes on to urge developers to really think things through and try to find another solution before resorting to CSS hacks:
Use CSS hacks and filters sparingly (and only as needed) to get non-compliant obsolete/abandoned browsers to comply to your presentational wishes.
Another very important message in Tantek’s post is aimed at browser manufacturers:
CSS2(.1) doesn’t say you can implement part of the spec. You’re supposed to implement the whole spec in the first place.
Wouldn’t it be great if all browser manufacturers could agree on that, and implement the whole CSS 2.1 spec properly and without bugs? Not very likely, but one can always hope…
Until then, I’m going to continue trying my hardest to avoid sending different CSS to different browsers.
- Previous post: Reading comment spam can be fun
- Next post: Redesign your site for Firefox now
Information, sponsorship, and externals
About the author
Roger Johansson is a Swedish web professional specialising in web standards, accessibility, and usability. More about me and this site.
Latest articles
- Validation statistics from Nikita the Spider Comments off
- An analysis of the sites crawled by the bulk validation tool Nikita the Spider during March 2008.
- Authentic Jobs API and Affiliates program Comments off
- The Authentic Jobs job listing service now has a public API and an affiliate program.
- What does Acid3 mean to you and me? Comments off
- Opera and Apple have announced that their web browsers pass the Acid3 Browser Test, but how will that help web designers and developers?
- Designing Web Navigation (Book review) Comments off
- Learn the fundamentals of navigation design and design better navigation systems for large and small sites as well as for web based applications.
- DOMAssistant bundle for TextMate Comments off
- To save keystrokes and speed up development I have created a DOMAssistant bundle for TextMate.
- First impressions of Internet Explorer 8 Beta 1 Comments off
- My impressions after trying out Internet Explorer 8 Beta 1 for a couple of days.









Comments
Using Conditional comments I think you can get away with sending diffrent css to diffrent browsers.
Using hacks you migth find yourself in an acward place when IE7 comes to make our lives hell on earth.
Its a bit more hassle than a simple hack, but I think we'll look back on hack's as we do on table layout.
Thankfully its a big might, as many of the things that will be fixed will mean that the hacks become useless as the browser understands the correct method (We hope).
I am however a little annoyed at a few of the other standards advocates, the ones that have been preaching the use of such things for so long, and then suddenly change face, being more than slightly hypocritical.
I understand that it is very important to learn from your mistakes, but thats no excuse to be an arse to others who have not caught on yet.
Well, one should only hack dead browsers. That has always been a good rule of thumb.
IE6 has been dead (not under development) for years now, so it has been a legitimate target in my opinion. Looks like they will fix enough in IE7 so that not even 'conditional comments' will be needed to hide old IE6 hacks from it. Hope it will come up to spec too.
New browsers should be fed progressive rules that they should pick up and turn into something useful, without breaking anything, as soon as they are up to spec. That's not hacking, as we can't wait until everything is working perfectly across browser-land before applying new styles.
Sorry, comments are closed for this post.