3 of 4

Reasons for doing HTML validation

by Andrew Wigglesworth

I write my HTML code by hand, and being human I make mistakes. Even if you don't always write your HTML directly, mistakes still creep in. Bits of code accidentally get left out, a tag might not be closed, a quotation mark may be left off, or there are just simple typing mistakes. Like a spell-checker, an HTML validator takes my code and makes sure it's "spelled correctly", or more accurately, that its syntax is correct.

The HTML markup standards are laid down by the World Wide Web Consortium (W3C), and it is their standards that web browsers (graphical, text or speech) try to follow and that a good HTML validator will validate against.

Leaving off a single closing </div> can throw a whole page out of whack. You might spot where the problem is straight away, but an HTML validator will flag it up for you and point out exactly where the problem lies. Add to that the mistakes that some browsers magically fix, though others don't, and you can start to see the real value of an HTML validator.

All of the HTML pages that I write go through this processing, in fact they are checked before they ever leave my computer. It's sensible and easy, you should do it too.

However (there's always a "however"), there are various misconceptions that have grown up about validation. The most prominent is a belief that passing the validation test for your HTML (and CSS) will somehow make your website "accessible" and your code will conform to the latest standards.

Validation does NOT:

* automatically make your site accessible to all.

* automatically allow your website to be readable/viewable in any (even up to date) programme.

* automatically allow your website to be readable/viewable on any device.

These are fallacies, sadly perpetuated by people with good intentions who hope that they've found a quick fix for their coding and website accessability issues. Sorry folks, validating your code is part of the process, but there's no easy answer here. You've still got to do the hard sweat and learn stuff for yourselves.

I would add to this the fact that it is still perfectly possible to validate a website against HTML 2, 3 and the old style so-called tag soup of HTML 4.01 Transitional; a potential accessibility nightmare!

NOTE: I'd recommend using HTML 4.01 Strict and looking up how to make accessible websites. A good starting point is the Web Access Initiative at the W3C website:

http://www.w3.org/WAI/

The Web Access Centre on the Royal National Institute for the Blind's (RNIB) website is also very useful:

http://www.rnib.org.uk

In the end, as I mentioned earlier, validating your code is a bit like using a spell-checker or a grammar-checker. Your text may pass with flying colours, but you could still be writing unintelligible nonsense.

OK, lets get down to it. I do it, you should do it, but how is it actually done?

There are a couple of good online validators. The World Wide Web Consortium (W3C) has a validator that can do single pages, or code pasted into a form. Sadly it's only one page at a time so it would be rather cumbersome to use regularly for large websites.

http://validator.w3.org/

The Web Design Group (WDG) have a validator that can do single pages and pasted code like the W3C, but theirs will also trawl a whole website and validate every page it finds. Their validator can be easily installed on GNU/Linux computers through most distribution's package manager. This is what I use on my own computer and it can validate hundreds of offline pages in a few seconds.

The online validator is on the WDG website at:

http://www.htmlhelp.com/tools/validator/

You can also have a go at installing the WDG validator on other systems like Windows or Apple, the instructions are on the WDG website.

Also, have a look at your favourite web editing software, often you'll find that there is a way to validate pages directly in it, or with a plugin. There is also the excellent Web Developer toolbar add-on for the Mozilla Firefox web browser that includes quick validation on the W3C site amongst a host of other useful tools.

A last word, to re-iterate: validating your HTML (and CSS) is good practice. Valid code is far more likely to make a good (and good looking) accessible website than non-valid code, but it is not the whole story.

Helium, Inc.
200 Brickstone Square Andover, MA 01810 USA