Ethan Marcotte now blogs at Unstoppable Robot Ninja.


Weblog entry:

The When, Why, and How of CSS hacking.

Not to make this an all Mezzoblue, all the time week of sidesh0w posts, but Dave raises an excellent question in his latest post on Browser Dependencies:

Until recently for example, I’d build sites in IE6/Win, and then ‘hack’ them to work in Mozilla. This only lead to problems down the line, since the original rendering relied on a buggy rendering engine (IE6) and created dependencies on it that better browsers won’t handle the way you’d expect them to….So now I develop in Firebird, and test later in IE. Is it better?

I’d say yes, and emphatically so (and no, not just ’cause Zeldman says it’s a good idea…though that’s obviously a good reason <grin />).

In the late nineties, the traditional practice of us front-end web developers was to start testing pages in your weakest target browser (e.g., Netscape 4), fix any deficiencies you found, and move up the ladder. The rationale here was driven largely by the song we were all singing at the time: get it looking the same in all of our target browsers, no matter the cost. But now, of course, we’ve seen the landscape change dramatically; we’re no longer able to consider simply the traditional desktop browser. We’re finding that our old definitions of functionality were too immured in notions of presentation, rather than accessibility and…well, functionality. Sure, your site looks as pretty in the Netscape of 1997 as it does in IE6, but is that good enough anymore?

So instead of looking back, we look ahead; we code our pages with web standards that ensure scaleable, maintainable code that’s accessible in any Internet-ready device. Is the best way to do that to start coding in one browser’s flawed rendering engine? Since those idiosyncracies could disappear in a year or three, I’d say no; instead, I’d argue that coding a site to standards should start with the most scaleable, solid foundation, into which you build exception cases as you need them. Build it correctly to a good, standards-compliant browser, then introduce hacks as necessary.

Seems like the best way forward to me. What do you think?

Comments

Hooray, technical difficulties.

There’s a WordPress issue that’s currently preventing old comments from displaying correctly. Sorry for the inconvenience, but hopefully we’ll be back online soon.