4 ms·
A simple guide to HTML <head> elements
- simonw 2y agoThis tag here: <meta charset="utf-8"> Is only strictly necessary if your web server isn't serving the charset as part of the content-type: content-type: text/html; charset=utf-8 There's no harm in including it though, and it does at least mean that if your HTML page is saved offline it will definitely carry its charset information with it.
- o11c 2y agoI would say the opposite: putting critical information only in HTTP headers is dangerous; always put it in the actual file; in some cases a file extension is sufficient.
- csande17 2y agoIf you do want to ensure the file is interpreted as UTF-8 regardless of HTTP headers, the most efficient way is to place a U+FEFF "byte order mark" character (EF BB BF when encoded as UTF-8) at the start of the file. It's shorter than a meta tag, and it's the first thing browsers check for when loading a file (assuming they're following https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding https://html.spec.whatwg.org/multipage/parsing.html#determin...).
- threatofrain 2y agoCould you explain the danger a little bit?
- o11c 2y agoChanging the encoding changes the meaning. If the encoding is only declared in a form that is easily lost during a standard action (downloading a file), that's bad.
- deleted 2y ago[deleted]
- dagss 2y agoI cannot zoom this page on mobile, very annoying...what is causing it? Anyway seems like a poor recommendation assuming the page is practicing what it is preaching here.
- csande17 2y agoThe site includes "maximum-scale=1.0" in its viewport meta tag, which prevents zooming. Funnily enough, the website doesn't actually recommend doing that anywhere in its text.
- BadBadJellyBean 2y agoProbably because of maximum-scale=1.0 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0">
- xigoi 2y agoGo to your browser’s accessibility settings and enable “force zoom”.
- ChrisArchitect 2y agoSome more discussion in 2019: https://news.ycombinator.com/item?id=21119553 https://news.ycombinator.com/item?id=21119553
- mncsz 2y ago[flagged]