Tantek Explains CSS Hacks

If you have ever touched a CSS “hack” Tantek’s latest post Pandora’s Box (Model) of CSS Hacks And Other Good Intentions is a must read. He covers the why, how and what of his early hacks, offers some basics on what makes a good hack, and tries to help you understand what you’re doing when using hacks including the pitfalls.

Its the kind of background you’ll never get if you simply look at one of the many available charts and pick the code that has the right combination o green and red boxes.

Web professionals aren’t the only target for the post, he also has a few things to say to browser developers including those working on the forthcoming IE7 (for those who don’t know the history, Tantek at one time worked for MS on their Mac IE product).

If you support the child selector, now all of a sudden you have to compliantly support all the other properties/values of CSS2(.1) that authors have been successfully using with the child selector.

But given that several other browsers do so (otherwise authors wouldn’t be using the child selector), and thus the market has demonstrated this is not a problem, this is a reasonable expectation.

However, if a browser is somehow unable to do so, then the answer is simple.

Don’t implement that selector, until that browser is able to do so. IE5/Mac did so, so can IE7, more than five years later…

But back on the topic of you and I in the web dev business, to paraphrase the big takeaway of the post, CSS hacks should:

  1. Be valid.
  2. Target ONLY older/frozen/abandoned versions of user agents / browsers.
  3. Be ugly.

Given situations like the upcoming IE7 and well, years of people blindly using hacks without thinking about them just because they work, its a very worthy read.

Comments Temporarily(?) Removed