HTML and CSS Reference
Simply put, it is quite important to aim for correct markup as a solid foundation for a
Web page and to not assume the markup is correct just because it appears to render
correctly in your favorite browser.
As shown earlier, a DTD defines the actual elements, attributes, and element relationships
that are valid in documents. Now you can take a document written in (X)HTML and then
check whether it conforms to the rules specified by the DTD used. This process of checking
whether a document conforms to the rules of the DTD is called validation .
The <!DOCTYPE> declaration allows validation software to identify the HTML DTD
being followed in a document, and verify that the document is syntactically correct—in
other words, that all tags used are part of a particular specification and are being used
correctly. An easy way to validate a document is simply to use an online service such as the
W3C Markup Validation Service, at http://validator.w3.org. If the malformed example
from the previous section is passed to this service, it clearly shows that the page has errors: