<p><pre><code> <meta name=viewport content="width=device-width, initial-scale=1">
</code></pre>
The `, initial-scale=1` has been unnecessary for a few years now (sorry, not searching for the citation now, hopefully you can find it if you’re interested), so it’s slimmer to use this instead:<p><pre><code> <meta name=viewport content="width=device-width">
</code></pre>
If you drop the quotes, it’ll parse the same way (and parsing is well-defined in HTML now, so you can be confident all browsers will handle all parsing the same) but be nominally non-conformant. Up to you how much you care about non-conformance, but I avoid writing non-conformant documents, though I do regularly hand-write minimal HTML (omitting html/head/body, skipping unnecessary closing tags, unquoting attribute values, <i>&c.</i>)<p>----<p><pre><code> <!DOCTYPE html>
</code></pre>
I strongly recommend against omitting this, because removing it throws you into quirks mode.<p>Also I recommend spelling it `<!doctype html>`, because that will regularly save a byte or two in gzipping due to the much greater frequency of lowercase letters.<p>----<p><pre><code> <meta charset=utf-8>
</code></pre>
I strongly recommend keeping this; it’s a safe bet that your text editor is working in UTF-8, so specifying the charset thus ensures that if later on you insert some non-ASCII (e.g. pasting a quote that includes curly quotes) it will work properly.<p>You can also save one more byte by spelling this `<meta charset=utf8>`. There’s fun history around that in the encoding spec, where that used to not be a valid value, but based on observing people spelling it that way sometimes they added it. So it’s now valid, but particularly old browsers might not like it.<p>----<p>Using <pre> for line breaks? Please no. Just don’t do this. The side-effects are awful. Use <br> if line breaks is all you want.<p>----<p>> <i>Both single-quotes and double-quotes are valid for tag parameters. This is useful for producing valid HTML output in programs without resorting to escaped double-quote.</i><p>I like to do minimal encoding. Within a quoted attribute value, the only characters that need to be escaped are & and the particular quote used, so for an attribute that includes a large blob of JSON I like to use single quotes, so that I only need to escape single quotes and ampersands:<p><pre><code> <a data-json='{"department":"R&amp;D"}'>…</a>
</code></pre>
This yields a smaller and more human-readable result, which is also nice.<p>----<p>> <i>You don't need to close your tags.</i><p>Well, there are three cases to consider here:<p>1. Self-closing tags like <meta>, which don’t <i>have</i> a closing tag (so it’s actively wrong to include one).<p>2. Tags for which the end-tag is optional, depending on what follows it, e.g. <p> doesn’t need </p> if it’s followed by various elements such as another <p>.<p>3. Non-conformant documents where the well-defined parsing behaviour just <i>happens</i> to produce what you want, despite what you’ve written being probably nonsensical and something where a human wouldn’t be sure what you meant.