Slap <!DOCTYPE html> at the top of a file and, by a common misconception, you have produced “an HTML5 document.” You have produced something — but the doctype is a rendering-mode switch, not a certificate of authenticity. The label and the substance are unrelated, and conflating them causes real confusion.
As we have covered elsewhere, the modern doctype exists to trigger standards mode. That is its entire job. It does not validate your markup, it does not check your nesting, and it most certainly does not confer membership in some club of “HTML5 documents.” A page riddled with unclosed tags, duplicate IDs, and <marquee> still gets standards-mode rendering. The switch flipped; the quality did not.
The specification does define what a valid document looks like — it just uses the word conforming, not “HTML5.” A conforming document follows the content model: elements appear where they are permitted, required attributes are present, and deprecated constructs are absent. Conformance is something you verify, not something you declare.
<!DOCTYPE html>
<html lang="en">
<head><title>Required</title></head>
<body>
<img src="x.png"> <!-- non-conforming: missing alt -->
<p><div>bad nesting</div></p>
</body>
</html>
That file has the doctype and still fails validation on two counts. It renders fine. It is not conforming. Both statements are true at once.
Here is the part people resist: there is no HTML5 to be a document of. The WHATWG maintains a living standard with no version number. The W3C once published snapshots labeled HTML5, HTML5.1, HTML5.2 — and then stopped, deferring to the living standard. So the precise thing to say is not “this is an HTML5 document” but:
The doctype is a promise about how the browser will treat you, not a promise you made about the quality of your work.
Because it changes what you do next. If you believe the doctype made your document “HTML5,” you stop there. If you understand that conformance is separate and verifiable, you run the Nu Html Checker, fix the missing alt, untangle the nesting, and ship something that is genuinely correct — not merely something wearing the right doctype.