3 ms·
>And if you’re worried about positioning, there’s nothing saying you can’t put your <title> in your <body> Well, the specification says you can't. >You can ju
by garaetjjte 6y ago
>And if you’re worried about positioning, there’s nothing saying you can’t put your <title> in your <body>
Well, the specification says you can't.
>You can just declare <html> and start spitting tags.
Strictly speaking, <html> is not required too. This is compliant HTML:
<!DOCTYPE html> <title>something</title> hello
But that's just notation thing, implicit element will be automatically opened/closed, all rules still apply. Thus
<!DOCTYPE html> hello <title>something</title>
is not valid, because 'hello' implicitly opens <body>, and <title> is not allowed to be there. Of course all of these would probably work in practice, because there's no junk that browser wouldn't happily accept. Discussed quine also violates standard, because it misses doctype and places <style> tags in body.
- derefr 6y ago> Well, the specification says you can't. If every implementation of a spec allows something that the spec doesn't, does it really matter what the spec says? I always understood the various web standards as descriptive, rather than prescriptive. They tell you what browsers will/won't accept. If all browsers accept something, it should (in RFC terminology) become a part of the standard. > places <style> tags in body Entirely separate note: given the semantics of the CSS cascade, shouldn't stylesheets in the body only apply to the DOM nodes succeeding them, not to DOM nodes preceding them? (I have a feeling that that complexity is why <style> isn't allowed in the body...)