Tips for Webmasters

Don't forget to add a doctype

add what?

For historical reasons, browsers behave more predictably and more uniformly when they parse HTML documents that start with a so-called Doctype declaration:

<!DOCTYPE html>

Why?

Initially, the Doctype declaration was used in HTML when it was defined as a language based on SGML, and later, on XML.

Since the presence of that declaration was in general a signal that the document author followed standard practices, that declaration was used in HTML5 to distinguish between a standards-compliant parsing mode and a so-called quirks parsing mode.

Whether you want to parse HTML files via an SGML or an XML parser, or simply make sure that your document gets parsed the same way across HTML5 processors, the doctype is a critical component of a quality HTML document.

Further Reading

About the "QA Tips"

The W3C QA Tips are short documents explaining useful
bits of knowledge for Web developers or designers, hosted and produced by the Quality Assurance
Interest Group at W3C.

While the tips are carefully reviewed by the participants of the group, they should not be seen
as anything else than informative bits of wisdom, and especially, they are not
normative W3C technical specifications.

Learn more about the Tips, how to submit your own pearls of wisdom, and find all the other QA
tips in the Tips Index.