Re:My Current HTML Boilerplate
by bloak on Tuesday April 27, 2021 @06:21AM
(#26954092)
This is the shortest thing starting with that doctype that I can get validator.w3.org to accept without error or warning:
[ Parent
| on HN ]
Re:My Current HTML Boilerplate
by chrismorgan on Tuesday April 27, 2021 @07:03AM
(#26954344)
The ="" there is unnecessary; writing an attribute name only implies an empty value.
If you’re going for shortest valid document at all, <!doctype html> is enough, provided the document exists in a context that makes title optional (e.g. email or <iframe srcdoc>) and that the charset is declared out-of-band.
You may be able to use a UTF BOM instead of the meta tag, or I think someone mentioned elsewhere having the server declare the character encoding in a header. I guess it depends on whether you count the header size which is better for golfing.