HTML Validator Debugger

Validate Local HTML

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.