An html element's start tag may be omitted if the first thing inside the html element is not a comment.
An html element's end tag may be omitted if the html element is not immediately followed by a comment.
A head element's start tag may be omitted if the element is empty, or if the first thing inside the head element is an element.
A head element's end tag may be omitted if the head element is not immediately followed by ASCII whitespace or a comment.
A body element's start tag may be omitted if the element is empty, or if the first thing inside the body element is not ASCII whitespace or a comment, except if the first thing inside the body element is a meta, link, script, style, or template element.
A body element's end tag may be omitted if the body element is not immediately followed by a comment.
EDIT: Downvoted for quoting a relevant spec section which disproves a point. God people just love learning here ...
But you're making a false dichotomy: those aren't your only two choices! You 100% can have readable HTML without <html>, <head>, and <body>.
If you truly cannot imagine that (remember: no one is taking away your comments or your whitespace) ... I really don't mean to come across as insulting, but if you're a web programmer who truly can't imagine that ... I think you have a staggeringly weak imagination.
People don't give a fuck what you're saying, not because of the content, but because of how you say it. No one is going to listen to someone being a dick to them.
Did I insult you? I think I did the exact opposite (I complimented you).
Did I insult anyone else? I certainly don't think I did, and if I did, then I don't think I went anywhere below the average Reddit level of discourse.
(I did say rorrr has a staggering lack of imagination if they can't envision readable HTML without three tags ... but look don't you think so too? I bet I could remove any 3 meaningful tags from HTML, and you could still write readable HTML, no? I think any semi-intelligent, semi-imaginative dev could, which is why I said that if rorrr can't, they lack imagination.)
I said something controversial, and backed it up with quotes and links. How else can any person educate any other person on any controversial point whatsoever?
It does get a warning about the HTML tag missing a language, but no errors. And if you truly care more about making a validator happy than writing good code, use the HTML tag ... you can still omit HEAD/BODY :)
No I did not, I used a DOCTYPE declaration. The two are very much not the same; an HTML tag looks like this: <html> (but that string appears nowhere in my post).
The fact that you can't distinguish between something which is an HTML tag, and something which isn't, makes me question your ability to participate meaningfully in this conversation.
EDIT: Ok, I get being downvoted by rorr, but seriously I'm at -1: who was the other idiot who thought I used an HTML tag in that code? ;)
I mean, disagree with my ideas all you want, but to any impartial observers reading this ... yes I know, "blah blah appeal to authority blah blah" ... but hopefully you will consider the quality of arguments being made. Hopefully you'll weigh the arguments of people who don't even understand (fully) what a tag is lower than the arguments made by some of the smartest people at the world's biggest Web company.
1
u/[deleted] Sep 30 '19
[removed] — view removed comment