The Importance of Validation

Once you've written a web page, you can upload it to an HTML validator. This site, run by the web's standards body, will check that your site is valid ('correct') HTML, and give you some idea of how to fix it if it isn't. This is an essential step in the development of any website - as vital as running your text through the spell checker - but whenever I recommend it there's always someone who wonders why it's so important. Well, here's why. You Know Your Code is Correct If your code validates, then it's correct, and therefore very likely to work as intended on every web browser out there. If you don't validate your pages, then you might find that people who visit your site with less forgiving browsers see nothing at all. Correct code is more likely to display correctly on many different browsers, because it puts them into their 'standards' mode. If code is even slightly incorrect, many browsers will use a different way of displaying it, known as quirks mode, which is designed to handle old and bad HTML, takes a long time and may make your page end up with errors you didn't expect. Without web standards, you end up going back to the bad old days of having to develop entirely separate web pages for different browsers. Validating by the standards ensures that all working browsers can view your content - if they can't, the fault's with them, not with you. Search Engines Like Valid Pages When it comes time for a search engine to add your page to its results, it's going to have a much easier time understanding the page if it's been validated. This will often get you a higher ranking in the results, which means free visitors for you. If your page isn't valid, search engines will often miss keywords in your pages or not understand your navigation, and may list nonsensical parts of your code under your site's name in the search results - not exactly helpful to potential visitors who want to know what your site is about. Mobile Devices More and more people are accessing the web using mobile devices like mobile phones and PDAs, and these devices have a lot of trouble with code that isn't valid. Because they have limited processing power, it would take them a very long time to try to untangle invalid code - they will simply strip out the formatting and do the best they can with it. Writing valid HTML lets users with mobile devices see your pages as you intended. Disabled People When you write valid code, it becomes much easier to view with things that aren't web browsers, such as screen readers. Technology for disabled people doesn't tend to be as forgiving as web browsers, so having valid code is important when it comes to working with these programs. Future-Proofing Before your code will validate, you need to explicitly say which version of HTML you had in mind when you created it. This future-proofs your code, as each version of the standard doesn't change once it's been decided on: a valid XHMTL 1.1 page will always be a valid XHTML 1.1 page, even if everyone else has moved on to XHTML 5. Once you've validated your site once, you can put it on the web and be confident that people are going to be able to read it for a long time to come. Finding Errors If there's a mistake in your website's code, validation gives you an easy way to track it down and fix it. Before validation, people had to test their site after each change and look carefully to make sure that nothing had gone wrong. Writing valid code lets you use programs that will examine what you've written and point at the exact place where the code doesn't validate. A List of Validators Here are a few validators that you can try. Most HTML validators are online, but there are a few that you can download and use on your own computer. The W3C validator: validator.w3c.org The WDG validator: www.htmlhelp.com/tools/validator CSE validator: www.htmlvalidator.com (downloadable) WebTechs validator: www.webtechs.com/html-val-src Doctor HTML: www.doctor-html.com (downloadable) You might also be interested in visiting the W3C's main site at w3c.org, as well as the Web Standards Project at www.webstandards.org.