3 ms·
> HTML is supposed to be <html><head>head stuff</head><body>body stuff</body></html>. It’s not. Every single part of what you quoted is optional, and you didn’
by JimDabell 5y ago
> HTML is supposed to be <html><head>head stuff</head><body>body stuff</body></html>.
It’s not. Every single part of what you quoted is optional, and you didn’t include the parts that are actually required.
This is a complete, valid, correct HTML document:
<!DOCTYPE html>
<title>…</title>
…
> But in practice you see […] missing HEAD sections […] missing BODY sections
You never see this, ever. It’s not possible to have an HTML document without a <head> or <body> element. The document I listed above has one <head> element and one <body> element. Both the opening and closing tags for these elements are optional. When an HTML parser parses that document, it will construct a DOM with those elements in it.
> If you omit all those tags, it still works, mostly.
Omitting these tags works completely. This is valid HTML that follows the HTML specification correctly without any need for error handling. All browsers follow these parsing rules without any problems.
- javajosh 5y agoYou beat me to the punch, but at least I can support with a link to the spec: https://html.spec.whatwg.org/dev/semantics.html https://html.spec.whatwg.org/dev/semantics.html