I was curious what wass the minimum-allowed HTML5 document. I think it is (neglecting newlines and indention whitespace, which are deleted to make the document shorter in character length):
<!doctype html>
<html lang>
<title>
.
</title>
With the .
replaceable by almost any plaintext character.
If you don't care about warnings, this works:
<!doctype html><title>.</title>
however, the HTML5 validator suggests:
Consider adding a
lang
attribute to thehtml
start tag to declare the language of this document.
To remove the warning, you could write something like:
<!doctype html>
<html lang="en">
<title>
.
</title>
Since all allowed lang
subtypes have at least two characters, there's no language shorter than en
(or de
or fr
or ja
, etc.). However, an empty lang
:
<!doctype html>
<html lang="">
<title>
.
</title>
is allowable, and does not even cause warnings. By the spec,
you can leave out the =…
when an attribute is empty. So, we can kill the =""
part, which gives us
<!doctype html>
<html lang>
<title>
.
</title>
or, removing whitespace, we get these 42 characters:
<!doctype html><html lang><title>.</title>
Is there a shorter one (that is actually HTML5, validates without warnings on the HTML5 validator, and doesn't "cheat" by messing with doctypes or comments)? Comment below!