3 ms·
> It makes no sense Why so? <head> is a conventional place for tags with document metadata semantics to live, but <head> has no semantic meaning itself. (I thi
by derefr 6y ago
> It makes no sense
Why so? <head> is a conventional place for tags with document metadata semantics to live, but <head> has no semantic meaning itself. (I think the only thing one could say about how UAs treat <head> is that some scraping robots might only parse <head>, discarding <body> entirely.)
And read my words above again: tags with document metadata semantics. Not “metadata tags.” All tags are just containers for DOM nodes or text, whatever additional implications they carry for the document. HTML is "a markup language for text first, and a container format for web pages second."
IMHO, <title> especially should be styled for display more often. It works great as an effective “<h0>“ tag, rather than duplicating <title>'s text into an explicit <h1> somewhere in the <body>. That way, the document only embeds its own title in one canonical location—a title which both gets rendered on the page, and displayed in the title bar. (And if you’re worried about positioning, there’s nothing saying you can’t put your <title> in your <body>. Yes, it will do the right thing.)
Tangent: in fact, there's really no reason to have <head> and <body> in your document at all. You can just declare <html> and start spitting tags. IMHO, despite going against a long-standing trend, it's a much more practical arrangement—especially if you keep all your "outside the content" formatting to CSS, and apply that CSS using a response header (https://www.w3.org/TR/html401/present/styles.html#h-14.6 https://www.w3.org/TR/html401/present/styles.html#h-14.6). If done correctly, your "full document" HTML can look exactly like your XHR-response "patch" HTML, such that your API endpoints can themselves render as full documents when viewed separately—without changing what they return! (I really need to blog about this.)
- 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...)
- sergeykish 6y agoI've tried visible <title> [1], it looks natural in search results title body ... vs default title content same in h1 content. body... Search engines claims that's error and may (I'm not sure) penalize. Have to use <meta description> to fix search results (its absence claimed as error too). [1] http://sergeykish.com/live-pages http://sergeykish.com/live-pages