3 ms·
I use: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> </head> <b
by twic 6y ago
I use:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
</head>
<body>
<h1></h1>
</body>
</html>
And according to the file timestamp, have done so since Nov 24 2005.
- chrismorgan 6y agoFor comparison, this would achieve the same thing now and is much shorter and more memorable: <!doctype html> <title></title> <h1></h1> (My recollection is that the HTML 4.01 Strict DTD doesn’t trigger quirks mode; if that’s correct, then it should be precisely the same, except for whitespace variation and the actual doctype node. Also neither is valid, because the title element can’t be empty.)
- bloak 6y agoThis is the shortest thing starting with that doctype that I can get validator.w3.org to accept without error or warning: <!doctype html><html lang=""><meta charset="UTF-8"><title>x</title>
- chrismorgan 6y agoThe ="" 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.
- aparks517 6y agoYou 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.
- twic 6y agoI fill in the title and h1 elements - this is just the template. And this version is not precisely the same, because it can't have the same timestamp :).
- JCVI-syn10 6y agoWow, I haven't seen an HTML 4.01 doctype in ages. Your boilerplate lacks all the features of this one...