A browser provided with HTML code must choose how it will display the web page. Even at the best of times browsers will tend to display web pages in slightly different ways; provided with broken code, each browser may show completely different results.
The best way to avoid this issue is to feed every browser valid code that follows the W3C specification. Any remaining variations in the way a browser displays your web page should be dealt with as exceptions (for example, feeding IE8 information wrapped in conditional comments.)
The W3C standardizes the HTML syntax and language. As such, it is the canonical reference for the validity of any web page code. The W3C provides a web-based validation service: where possible, I would suggest using a tool to gain easy access to this service, such the Web Developer extension for Firefox or Chrome, or DreamWeaver’s Validator. (Note that not all of these tools currently point to or use the Nu validator).
However it is used, the validator will provide either a green “good to go” bar, or a red error bar indicating that the page has validation errors, listed further down on the same feedback page. While the explanation of the source of these errors can be rather technical, reading through them does provide solutions to web page problems.
Occasionally the validator will be inaccessible due to overload or other technical issues. In those circumstances, both the browser extensions and DreamWeaver’s built-in validation service will fail, since they rely on the validation API. If this ever occurs, there are some alternatives:
- Often, it is only the “automatic” validator that is offline; you can usually still use the service by copying and pasting your code into a text box on the site or by pointing the service to a URL.
- Use one of the alternative web page validators described in the next article.
Some common questions:
- “Should every page on my site validate?”
- It’s not an absolute requirement unless you are taking one of my classes, but it is a very good idea. Once you know the rules, creating valid code is very easy, and usually makes for better, lighter, well-constructed pages. There is just one case in which invalid code should be accepted: if you are correctly using markup that have not yet made it into the final spec, and therefore will be reported as errors.
- “Does a valid page mean that it is well-made or well-designed?”
- No. It’s entirely possible to make a page that is poorly designed and coded that still validates. However, validation is an excellent first step.
Validation is only the first step of a suite of tests that are required for a good web page; we’ll talk about the other evaluations in later articles.
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.