HTML Validators and HTML Validation

By: Dusty Arlia
Published on July 23, 2012
Last Updated on Friday, July 10, 2015 at 11:43 PM
Total Updates: 4

You should always validate your webpages. Different rules apply to each variant of HTML and validating your HTML pages ensures your coding them correctly

An HTML validator is a program that checks your HTML code to make sure it's written properly. The first thing the validator does is check the doctype of the page you're validating. Next, it analyzes the code in the page to see whether it matches the rules defined by that doctype. The validator will flag mistakes like misspelled tag names or unclosed tags.

The World Wide Web Consortium (W3C) provides a free validator to the public. The W3C is responsible for many of the technologies used on the internet. To use the validator follow this url: http://validator.w3.org. Once you're there you can either copy and paste your code into the validator, point the validator to your URL, or upload your webpage to the W3C site. The validator then analyzes the HTML and generates a report saying whether or not your page is valid. Your errors will appear on the report with a line number indicating which line of your code has an error.

There is also HTML validator plug-ins available for some browsers (like Firefox and Safari). Validating your code has benefits for JavaScript as well. The validator will catch errors that will affect your JavaScript. For instance, forgetting your closing tag, using the same ID more than once, or improperly nesting your HTML tags can make your JavaScript behave erratically or not at all. Validators can catch these problems for you.

Comments:

Ad: