Why is it important to validate your HTML code?

Validation improves usability and functionality because your users are less likely to run into errors when displayed on browsers compared to non-validated websites. Validation is fully compatible with a wide range of dynamic pages, scripting, active content, and multimedia presentations.

What does it mean to validate your code?

Code validation is the process of checking that the coding of a web page is in compliance with the standards and recommendations set by the World Wide Web Consortium (W3C) for the web. Code validation helps to produce clean code.

How do you validate your HTML?

In order to validate your code, you have to declare the standard to which it adheres. To describe the HTML standard (the document type declaration, DTD), the file should contain a DOCTYPE declaration (before the HTML code). Here are a few examples (from http://www.htmlhelp.com/tools/validator/doctype.html).