Client Side

All the fancy frizz

CSS Hacks are not ok

Written by: Peter Fisher on November 12, 2010
Tagged under: , ,
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

In response to the article David Walsh wrote GET OVER IT! 6 Things Web Developers Need to Get Over I have to disagree on point 2 (Get Over It CSS Hacks are OK!).

CSS hacks are usually added to a style-sheet to fix the many IE annoyances and the continuing lack of standard compliance. Each version of Internet Explorer has its own list of errors and hacks to go with them.

Most of these hacks aren’t correct CSS syntax and therefore are not valid in W3C’s eyes. Even worse, some of these hacks may end up breaking legitimate code and force other browsers to break as a result.
I’m all for hacking a style-sheet to get the dam browser to render correctly but I’m not in favor of lowering the standard of a style-sheet when used by a superior browser.
Why should we inflict broken and unreadable style-sheets on other browsers just so Internet Explorer can work. Isn’t it better to compromise and have two style-sheets. One for superior browsers and one for broken browsers?
That way the superior browsers such as FireFox and Chrome wont see the hacked up CSS . Instead they will see a nice clean, legitimate and standard compliant script.

Of course David makes a valid point about not wanting to make additional  HTTP requests.

I want to cut down on requests and when I think of editing CSS, I don’t want to be jumping from stylesheet to style to find something.  Get over it.

However these requests will only be made if its a legacy browser and I’m happy to give these browser a bit more work.

The point about not having to jump through different style-sheets is also valid. However its a pain that I’m willing to take. If there is a hacks.css with all the “fixes” then it should be fairly straight forward to make a change.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Peter Fisher is a web developer working in Gloucester UK. Founder of the digital agency Websomatic, author of this blog and the HowToCodeWell Youtube channel. Peter has over ten years of web development experience under his belt

Read all about Peter Fisher

Leave a Reply

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