Minimum HTML 5 Document

Dustin Diaz recently posted about skinny doctypes, which basically boiled down to:

[sourcecode lang=”html”]

[/sourcecode]

Folks in the comments pointed out that this is the doctype that HTML 5 uses. I’d only been glancing at HTML 5 from time to time, but this got me to look at it a little bit closer. I went to the W3C Validator to see what the minimum HTML 5 document looked like. Here’s the smallest document that still validated:

[sourcecode lang=”html”]

[/sourcecode]

Now this is what I’m talking about, simple and to the point.

The validator does give one warning for this document, but it’s simply to mention that HTML 5 conformance is still experimental.

4 Comments

  1. That’s untrue: the html, head, and body elements all have optional start and end tags. The shortest valid document is:

    <doctype html><title></title>

  2. Nice catch, that does pass as valid HTML5. That might be a little too minimal though ๐Ÿ™‚

  3. Geoffrey, that’s a fun test and all ๐Ÿ™‚ But basically the point was that we can actively and confidently use [!doctype html]

  4. Actually, it doesnโ€™t. Geoffrey forgot the ! in <!doctype html> :p

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2019 Joseph Scott

Theme by Anders NorénUp ↑