A post called Trash All IE Hacks! on the (rather lovely) Web Designer Wall blog has attracted a huge amount of comments recently with its call to stop pandering to those who have the audacity to still be using the previous version of Internet Explorer (approx. 80% of visitors on one site I manage), and to display the broken layout as punishment for anyone not au fait with modern browsers.
Just in case you missed it, I was being sarcastic there; to take that attitude would be like a TV station transmitting black & white signals to anyone who hasn’t yet bought a High Definition set.
From the many supportive comments, a few said things like
85% of my time is wasted coding for IE6! or
I spent two nights getting the layout to work in IE6!; to that, I can only reply: either you are doing something wrong, or you are a bad coder – or both.
It’s not hard to get sites to display properly in IE6; sure, you’ll have to put in a little extra effort, but it shouldn’t be anything like 85% of your time, or 50%, or even 10%. All you need to do is follow these five simple steps:
Use the correct doctype.
I won’t go into the details of what a doctype is or what it does (you can get that here); all you need to know is that if you put the correct doctype for the code you are writing in the very first line of your page, you’ll nip a lot of potential problems in the bud.
Start from a level playing field
Write good code.
I’d wager that many ‘IE6 mistakes’ are down to quality of input. Aim to make your code validate (use the W3C’s CSS Validator and their spiffy new Markup Validator), but don’t get too hung up on it if it doesn’t, as long as you know why it doesn’t.
Know why things go wrong.
Find out which IE6 bugs exist, and what you can do to work around them. Sometimes you will have to add a little extra markup, but more often than not you can fix problems without it.
Keep your fixes clean.
Add any necessary fixes in a stylesheet with conditional comments; do not be tempted to use CSS hacks. Unless you are coding your site with extensive use of CSS 3 selectors, I bet you can resolve most problems in a few lines.
There will be times when IE6 has you slapping your forehead in frustration, of that there’s no doubt; but if your palms are sore and your forehead burning, it could be that the problem lies not with the browser, but with you.