Why Validate Your HTML ?
Creating Valid HTML Documents Means Cleaner Code and Easier Maintenance
I'll be the first one to let you in on a secret: building Web pages isn't hard.
With the software that is available now, you can write your Web page and have
it up and viewable in half an hour. And with these tools, why would you need to
run an HTML validator on your HTML to find errors? Well, you don't have to, but
if you want your pages to stay viewable through future versions of HTML, or you
want newer browsers to be able to display it correctly, then writing valid HTML
is the place to start.
There are several specific reasons for writing valid HTML, and using an HTML
validator to insure that what you write is valid:
- Future compatibility
As browsers evolve, they come closer and closer to supporting the standard HTML
as written by the W3C. Even if they don't fully support the most recent version
of HTML, the browser builders go in and make sure that they are compliant with
older versions of the standard.
If you are writing non-standard HTML, there is a chance that as browsers
evolve, they will no longer support your Web pages. A good example of this is a
trick that some Web developers used with an older version of Netscape. If you
included multiple body tags with different colors, Netscape would load them all
in in succession creating a fade-in or flicker effect as the page loaded. This
trick no longer works, as it relied on an incompatibility of the browser.
- Current browser viewing
Unless you know for a fact that your entire audience is using a specific
browser, you are setting your site up to annoy some of your readers if you make
it inaccessible to them through invalid or non-standard HTML. Many HTML
validators will check your HTML for browser specific entities and alert you to
their use.
Browser specific HTML can be part of the standard (IE supports the
<iframe> tag, but Netscape does not) or not a part of the standard (the
<marquee> tag is supported by IE and the <layer> tag is supported
by Netscape, but neither are a part of the HTML 4 standard).
- Fewer strange problems
I am often asked to look at Web pages for people to tell them why the code is
doing something strange. I can usually come back in just a few minutes and tell
them what is wrong. Why? It's not because I know HTML inside and out, it's
because I run their page through an HTML validator. This usually points out a
problem with the HTML, that, when fixed, solves their problem as well.
For example, often people will design a beautiful page with tables and view
it in IE. Then, a couple days later their friend calls them up to ask them
why they have a blank page up on their site (as viewed in Netscape). The
problem is that Netscape interprets the tables standard (the ending
</table> tag is required) strictly and IE does not. You could argue that
IE is being more flexible, but what if they decide in IE 6 to interpret the
HTML standard more strictly? With the merging of XML and HTML into XHTML, this
may easily become a reality. And suddenly, your pages no longer work for IE.
But if you had written valid HTML, you wouldn't have had that problem.
HTML Validators
There are a lot of validators available. You can get ones that are run on your
computer, embedded into your HTML editor, or online on your live Web pages. Here
are two of my favorite HTML Validators:
CSE HTML Validator
This is a powerful HTML validator that comes embedded in HomeSite, or you can
get a standalone version. It checks your tag spelling, attributes, character
entities, quotation marks, missing end tags, invalid nesting of tags, and more.
If you are looking for a Windows based validator, this is a great one to use.
Doctor Watson
This is the online validator I use the most. Doctor Watson provides great
analysis of Web pages that is easy to use and understand. It is also fast. One
of the things I like best about it is the style checking. This isn't of CSS,
but rather of how you wrote your Web page and includes warnings about things
like using "click here" as a link, and other elements of bad Web style.
I hope this came in useful!
Ask in the forum
if you have any suggestions or comments.
|