
In Jeff Croft’s latest article, he rants a bit about how some people (i.e. “assholes”) point out errors in another developer’s markup, publicly humiliating them. Although much of it was venting, his post does bring up an important point that I have been meaning to write about. That is, a markup validator (like the W3C’s HTML Validator) is debugging tool. I think this is a very important point and some developers need to change their thinking.
Back in the day, developers were told to validate their markup purely to make sure it was correct, with no other reason for validating. Why? Because fixing bad markup didn’t necessarily solve your browser rendering problems when the browsers themselves didn’t adhere to web standards. If you didn’t close tags, a browser in quirks mode would often fix them for you. Therefore, developers began thinking that validating markup was purely an optional exercise at the end of development for verifying markup correctness. An exercise for keeners and a way to tout your 1337ness (I’m guilty of this). There was little reason to validate (or “debug”) your markup during development.
Things have changed however. IE7 and Firefox are adhering to most web standards and a lot of rendering problems are often the result of bad markup. The first thing I always ask when a developer comes to me with a “CSS problem” is if they have validated their markup and more often than not they haven’t. I’ve noticed developers tend to blame CSS for all of their rendering problems. Often saying something irrational like, “Damnit! I should have just used tables!” or “IE7 is a piece of shit!” (I’ve done this). Then when they validate their markup, there’s over a hundred errors. To make matters worse, they’ve likely added a bunch of junk to their CSS trying to fix rendering problems that were markup problems.
These days I validate my markup as I encounter rendering problems during development. I use Web Developer‘s “Validate Local HTML” tool, which uploads the generated markup of the current page to the W3C’s HTML Validator and reports on the errors found. It’s a very convenient way to debug markup from your local development environment. Debugging markup during development like this has saved me a lot of headaches.

Mel
Hi Brad
I couldn’t agree more I am often given the task of fixing other people’s browser rendering problems and a lot of the time its not the css but bad markup that starts them digging themselves into a bigger whole as you mentioned, they will often start hacking at the css trying to fix something that valid markup would have solved.
I find the HTML validator extension for firefox extremely useful in development http://users.skynet.be/mgueury/mozilla/ if i don’t see a little tick in the bottom of my browser window it gives me a clue to checkout my markup to see whats going on.
Mel
April 7th, 2008 at 12:13am
bradt
Thanks for the suggestion Mel. That is definitely a handy add-on.
April 7th, 2008 at 9:27am
bradt.ca » Preventing IE6 bugs
[...] in standards mode, so it is important to fix before attempting anything else. I’ve previously discussed the tools I use to do [...]
December 26th, 2008 at 8:25am