Web Hosting

Website Validation: My Biggest Shock This Week

I'm just on the point of launching my web site services business, so this post from Eric at Web Services and Tools caught my eye.

Given that one of the services I'll be offering is website design I figured it would be a good move to make sure my own sites were properly designed, and validated, in line with the W3C standards.

I was reasonably confident that I'd be OK, since my sites are deliberately simple and straightforward. I avoid scripts and Flash as far as possible, as well as weird and wonderful creative effects.

So I was pretty shocked when I ran my site through the online validator: 268 errors and 17 Warnings.


And some of the errors seemed to be incorrect.  For example it told me that there was no character set defined, but there was.  It was in the second line in the HEAD section.

(Forgive the use of CAPS - if I put these tag names in angled brackets, as they should be described, all the RSS feeds think they're HTML tags and suppress them).

It also told me the "target" attribute wasn't allowed (the way you can define where a link should open).

So I got on the phone to Eric to ask a few questions.

Turns out that one of the most important factors in getting your site correctly validated is getting the DOCTYPE declaration correct.  This tells browsers (and the validator) what coding you are using and, therefore, what standards to apply.

My DOCTYPE was wrong.

I also had a number of other genuine errors - for example neglecting to put 'alt' tags on all my images, incorrectly re-using div id's, incorrectly using the CENTER tag and so on.

Eric was kind enough to find the correct DOCTYPE declaration for me (there are lots of them) and point out the correct tags I should be using and I got down to work.

The first page took an age to correct, but I did eventually get zero errors and zero warnings.  Woo Hoo - I got to put the W3C badge on that page.

Having done my first page, the remaining pages were much quicker and easier to do, and now all the pages on my new site comply with the standards.

Why should this be important?

Of most relevance to webmasters generally is that it will help to ensure your web pages render correctly in as many different browsers as possible.

I'm not making a blanket statement here quite deliberately.  Web standards are still evolving and many browsers in use today do not conform.  For example, it was only with IE 8 (the most recent version) that Microsoft's Internet Explorer browser complied fully with the standards.  And Internet Explorer held as much as 80% of the browser market until recently!

So even if your websites comply with the W3C standards, your pages could still render incorrectly if they're being viewed on a browser that doesn't comply.

Of course, of most interest to me, given my new business, was the ability to state that my websites comply with industry standards.

Happily I can now say that they do.

Web Hosting