I liked the following: ↷

An opinionated list of best practices for textual websites

<p><em>The following applies to minimal websites that focus primarily on text. It does not apply to websites that have a lot of non-textual content. It also does not apply to websites that focus more on generating revenue or pleasing investors than being good websites.</em></p><p>This is a “living document” that I add to as I receive feedback. See the <a href="https://git.sr.ht/~seirdy/seirdy.one/log/master/item/content/posts/website-best-practices.md">changelog</a>.</p><p>I realize not everybody’s going to ditch the Web and switch to Gemini or Gopher today (that’ll take, like, a month at the longest). Until that happens, here’s a non-exhaustive, highly-opinionated list of best practices for websites that focus primarily on text:</p><ul><br><li>Final page weight under 50kb without images, and under 200kb with images. Page weight should usually be much smaller; these are upper-bounds for exceptional cases.</li><li>Works in Lynx, w3m, links (both graphics and text mode), NetSurf, and Dillo</li><li>Works with popular article-extractors (e.g.&nbsp;Read­ability) and HTML-to-Markdown converters. This is a good way to verify that your site uses simple HTML and works with most non-browser article readers (e.g.&nbsp;ebook converters, PDF exports).</li><li>No scripts or interactivity, preferably enforced at the Content-Security-Policy (<abbr title="Content Security Policy">CSP</abbr>) level</li><li>No cookies</li><li>No animations</li><li>No fonts–local or remote–besides <code>sans-serif</code> and <code>monospace</code>.</li><li>No requests after the page finishes loading</li><li>No 3rd-party resources (preferably enforced at the CSP level)</li><li>No lazy loading</li><li>No custom colors OR explicitly set both the foreground and background colors for light and dark color schemes, knowing that these can be overridden.</li><li>A maximum line length for readability</li><li>Server configured to support compression (gzip, optionally Brotli and Zstandard as well). It’s a free speed boost.</li><li>Supports dark mode via a CSS media feature and/or works with most “dark mode” browser addons. More on this below.</li><li>A good score on Mozilla’s <a href="https://observatory.mozilla.org/">HTTP Observatory</a>. A bare minimum would be 50, but it shouldn’t be too hard to hit 100.</li><li>Optimized images.</li><li>All images labeled with alt-text. The page should make sense without images.</li><li>Probably HTTP/2. Maybe even HTTP/3. Run some tests to see if this is worth it if you’re so inclined.</li><li>Works well with Tor and the Tor Browser’s safety settings.</li><li>Preserve link underlines.</li><li>Handle a wide variety of viewport sizes without dramatic layout changes</li></ul><p>I’d like to re-iterate yet another time that this only applies to websites that primarily focus on text. If graphics, interactivity, etc. are an important part of your website, less (possibly none) of this article applies. My hope is for most readers to consider <em>some</em> points I make on this page the next time they build a website. I don’t expect–or want–anybody to follow 100% of my advice.</p><p>Earlier revisions of this post generated some responses I thought I should address below. Special thanks to the IRC and <a href="https://lobste.rs/s/akcw1m">Lobsters</a> users who gave good feedback!</p><p>I’ll also cite the document <cite><a href="https://www.w3.org/WAI/WCAG22/Techniques/">Techniques for WCAG&nbsp;2.2</a></cite> a number of times. Unlike the Web Content Accessibility Guidelines (<abbr title="Web Content Accessibility Guidelines">WCAG</abbr>), the Techniques document does not list requirements; rather, it serves to educate authors about <em>how</em> to use specific technologies to comply with the WCAG. I don’t find much utility in the technology-agnostic goals enumerated by the WCAG without the accompanying technology-specific techniques to meet those goals.</p><h2 id="security">Security</h2><p>One of the defining differences between textual websites and advanced Web&nbsp;2.0 sites/apps is safety. Most browser vulnerabilities are related to modern Web features like JavaScript and WebGL. The simplicity of basic textual websites <em>should</em> guarantee some extra safety; however, webmasters need to take some additional measures to ensure limited use of “modern” risky features.</p><h3 id="tls">TLS</h3><p>All of the simplicity in the world won’t protect a page from unsafe content injection by an intermediary. Proper use of TLS protects against page alteration in transit and ensures a limited degree of privacy. Test your TLS setup with <a href="https://testssl.sh/">testssl.sh</a> and <a href="https://webbkoll.dataskydd.net/">Webbkoll</a>. Mozilla’s <a href="https://observatory.mozilla.org/">HTTP Observatory</a> offers a subset of Webbkoll’s features but it also gives a beginner-friendly score. Most sites should strive for at least a 50, but a score of 100 or even 120 shouldn’t be too hard to reach.</p><p>A false sense of security is far worse than transparent insecurity. Don’t offer broken TLS ciphers, including TLS 1.0 and 1.1. Vintage computers can run TLS 1.2 implementations such as BearSSL surprisingly efficiently, leverage a TLS terminator, or they can use a plain unencrypted connection. A broken cipher suite is security theater.</p><h3 id="scripts-and-the-content-security-policy">Scripts and the Content Security Policy</h3><p>Consider taking hardening measures to maximize the security benefits made possible by the simplicity of textual websites, starting with script removal.</p><p>JavaScript and WebAssembly are responsible for the bulk of modern web exploits. Ideally, a text-oriented site can enforce a scripting ban at the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP"><abbr title="content security policy">CSP</abbr></a> level.</p><figure><br><figcaption><br><p>This is the CSP for my website:</p></figcaption><pre tabindex="0"><code>content-security-policy: default-src 'none';<br>img-src 'self' data:;<br>style-src 'sha256-g8fT13xy415WmQo4vYgG4v4xJiNmrhPYQ9PGDGfXX5Y=';<br>style-src-attr 'none';<br>frame-ancestors 'none'; base-uri 'none'; form-action 'none';<br>manifest-src https://seirdy.one/manifest.min.ca9097c5e38b68514ddcee23bc6d4d62.webmanifest;<br>upgrade-insecure-requests; navigate-to 'none';<br>sandbox allow-same-origin<br></code></pre></figure><p><code>default-src: 'none'</code> implies <code>script-src: 'none'</code>, causing a compliant browser to forbid the loading of scripts. Furthermore, the <code>sandbox</code> CSP directive forbids a <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox">wide variety</a> of potentially insecure actions. While <code>script-src</code> restricts script loading, <code>sandbox</code> can also restrict script execution with stronger defenses against script injection (e.g. by a browser addon).<sup id="fnref:1"><a href="https://seirdy.one/2020/11/23/website-best-practices.html#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup> I added the <code>allow-same-origin</code> parameter so that these addons will still be able to function.<sup id="fnref:2"><a href="https://seirdy.one/2020/11/23/website-best-practices.html#fn:2" class="footnote-ref" role="doc-noteref">2</a></sup></p><h3 id="if-you-must-enable-scripts">If you must enable scripts</h3><p>Please use progressive enhancement (<abbr title="progressive enhancement">PE</abbr>)<sup id="fnref:3"><a href="https://seirdy.one/2020/11/23/website-best-practices.html#fn:3" class="footnote-ref" role="doc-noteref">3</a></sup> throughout your site; every feature possible should be optional, and scripting is no exception.</p><p>I’m sure you’re a great person, but your readers might not know that; don’t expect them to trust your website. Your scripts should look as safe as possible to an untrusting eye. Avoid requesting permissions or using <a href="https://browserleaks.com/javascript">sensitive APIs</a>.</p><p>Finally, consider using your CSP to restrict script loading. If you must use inline scripts, selectively allow them with a hash or nonce. Some <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types">recent directives</a> restrict and enforce proper use of <a href="https://web.dev/trusted-types/">trusted types</a>.</p><h2 id="about-fonts">About fonts</h2><p>If you really want, you could use serif instead of sans-serif; however, serif fonts tend to look worse on low-res monitors. Not every screen’s <abbr title="Dots Per Inch">DPI</abbr> has three digits.</p><p>To ship custom fonts is to assert that branding is more important than user choice. That might very well be a reasonable thing to do; branding isn’t evil! That being said, textual websites in particular don’t benefit much from branding. Beyond basic layout and optionally supporting dark mode, authors generally shouldn’t dictate the presentation of their websites; that should be the job of the user agent. Most websites are not important enough to look completely different from the rest of the user’s system.</p><p>A personal example: I set my preferred browser font to “sans-serif”, and map “sans-serif” to my preferred font in my computer’s fontconfig settings. Now every website that uses sans-serif will have my preferred font. Sites with sans-serif blend into the users’ systems instead of sticking out.</p><h3 id="but-most-users-dont-change-their-fonts">But most users don’t change their fonts…</h3><p>The “users don’t know better and need us to make decisions for them” mindset isn’t without merits; however, in my opinion, it’s overused. Using system fonts doesn’t make your website harder to use, but it does make it smaller and stick out less to the subset of users who care enough about fonts to change them. This argument isn’t about making software easier for non-technical users; it’s about branding by asserting a personal preference.</p><h3 id="cant-users-globally-override-stylesheets-instead">Can’t users globally override stylesheets instead?</h3><p>It’s not a good idea to require users to automatically override website stylesheets. Doing so would break websites that use fonts such as Font Awesome to display vector icons. We shouldn’t have these users constantly battle with websites the same way that many adblocking/script-blocking users (myself included) already do when there’s a better option.</p><p>That being said, many users <em>do</em> actually override stylesheets. We shouldn’t <em>require</em> them to do so, but we should keep our pages from breaking in case they do. Pages following this article’s advice will probably work perfectly well in these cases without any extra effort.</p><h3 id="but-wouldnt-that-allow-a-website-to-fingerprint-with-fonts">But wouldn’t that allow a website to fingerprint with fonts?</h3><p>I don’t know much about fingerprinting, except that you can’t do font enumeration without JavaScript. Since text-based websites that follow these best-practices don’t send requests after the page loads and have no scripts, they shouldn’t be able to fingerprint via font enumeration.</p><p>Other websites can still fingerprint via font enumeration using JavaScript. They don’t need to stop at seeing what sans-serif maps to: they can see all the available fonts on a user’s system, the user’s canvas fingerprint, window dimensions, etc. Some of these can be mitigated with Firefox’s <a href="https://support.mozilla.org/en-US/kb/firefox-protection-against-fingerprinting">protections against fingerprinting</a>, but these protections understandably override user font preferences.</p><p>Ultimately, surveillance self-defense on the web is an arms race full of trade-offs. If you want both privacy and customizability, the web is not the place to look; try Gemini or Gopher instead.</p><h2 id="about-lazy-loading">About lazy loading</h2><p>Lazy loading may or may not work. Some browsers, including Firefox and the Tor Browser, disable lazy-loading when the user turns off JavaScript. Turning it off makes sense because lazy-loading, like JavaScript, is a fingerprinting vector. Specifically, it identifies idiosyncratic scrolling patterns:</p><figure itemscope="" itemtype="https://schema.org/Quotation"><br><blockquote><br><p>Loading is only deferred when JavaScript is enabled. This is an anti-tracking measure, because if a user agent supported lazy loading when scripting is disabled, it would still be possible for a site to track a user's approximate scroll position throughout a session, by strategically placing images in a page's markup such that a server can track how many images are requested and when.</p></blockquote><figcaption class="h-cite" itemprop="citation"><br>— <cite itemprop="isPartOf" itemscope="" itemtype="https://schema.org/TechArticle"><a class="u-url p-name" itemprop="url" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img"><span itemprop="name">&lt;img&gt;: The Image Embed element</span></a></cite> on <abbr title="Mozilla Developer Network">MDN</abbr>, <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading"> the <code>loading</code> attribute</a><br></figcaption></figure><p>If you can’t rely on lazy loading, your pages should work well without it. If pages work well without lazy loading, is it worth enabling?</p><p>I don’t think so: lazy loading often frustrates users on slow connections. I think I can speak for some of these users: mobile data near my home has a number of “dead zones” with abysmal download speeds, and my home’s Wi-Fi repeater setup occasionally results in packet loss rates above 60%&nbsp;(!!).</p><p>Users on poor connections have better things to do than idly wait for pages to load. They might open multiple links in background tabs to wait for them all to load at once, and/or switch to another task and come back when loading finishes. They might also open links while on a good connection before switching to a poor connection. For example, I often open 10-20 links on Wi-Fi before going out for a walk in a mobile-data dead-zone. A Reddit user reading an earlier version of this article described a <a href="https://i.reddit.com/r/web_design/comments/k0dmpj/an_opinionated_list_of_best_practices_for_textual/gdmxy4u/">similar experience</a> riding the train.</p><p>Unfortunately, pages with lazy loading don’t finish loading off-screen images in the background. To load this content ahead of time, users need to switch to the loading page and slowly scroll to the bottom to ensure that all the important content appears on-screen and starts loading. Website owners shouldn’t expect users to have to jump through these ridiculous hoops.</p><p>A similar attribute that I <em>do</em> recommend is the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img#attr-decoding"><code>decoding</code></a> attribute. I typically use <code>decoding="async"</code> so that image decoding can be deferred.</p><h3 id="would-pre-loadingpre-fetching-solve-the-issues-with-lazy-loading">Would pre-loading/pre-fetching solve the issues with lazy-loading?</h3><p>Pre-loading essential resources is fine, but speculatively pre-loading content that the user may or may not request isn’t.</p><p>A large number of users with poor connections also have capped data, and would prefer that pages don’t decide to predictively load many pages ahead-of-time for them. Some go so far as to disable this behavior to avoid data overages. Savvy privacy-conscious users also generally disable pre-loading since pre-loading behavior is fingerprintable.</p><p>Users who click a link <em>choose</em> to load a full page. Loading pages that a user hasn’t clicked on is making a choice for that user. I encourage adoption of “link” HTTP headers to pre-load essential and above-the-fold resources when possible, but doing so does not resolve the issues with lazy-loading: the people who are harmed by lazy loading are more likely to have pre-fetching disabled.</p><h3 id="cant-users-on-poor-connections-disable-images">Can’t users on poor connections disable images?</h3><p>I have two responses:</p><ol><br><li>If an image isn’t essential, you shouldn’t include it inline.</li><li>Yes, users could disable images. That’s <em>their</em> choice. If your page uses lazy loading, you’ve effectively (and probably unintention­ally) made that choice for a large number of users.</li></ol><h2 id="about-custom-colors">About custom colors</h2><p>Some users’ browsers set default page colors that aren’t black-on-white. For instance, Linux users who enable GTK style overrides might default to having white text on a dark background. Websites that explicitly set foreground colors but leave the default background color (or vice-versa) end up being difficult to read. Don’t strain your eyes trying to read this example:</p><figure><br><a href="http://bettermotherfuckingwebsite.com/"><br><picture><br><source srcset="/p/website_colors.7c5923ce606da78a23351613074ef3dd.avif" type="image/avif"><br><source srcset="/p/website_colors.0076598c2e6102ef2b0b596aaf09be90.webp" type="image/webp"><br><source srcset="/p/website_colors.edabb85e9cb5e77cc0f45f4a6da9987d.png" type="image/png"><br><img width="400" height="241" src="https://seirdy.one/p/website_colors.png" alt="Screenshot of a website with gray text on a darker grey background. Details in the caption" decoding="async"><br></picture><br></a><br><figcaption><br><p>This is an unreadable screenshot of a website <a href="http://bettermotherfuckingwebsite.com/">promoting browser style overrides</a> (specifically, the “A little less contrast” section). I had set my browser foreground and background colors to white and dark gray, respectively. The website overrode the foreground colors while assuming that everyone browses with a white background.</p></figcaption></figure><p>A second opinion: <span itemscope="" itemtype="https://schema.org/Person" class="h-card vcard"><br><a itemprop="url" href="https://utcc.utoronto.ca/~cks/" class="u-url url"><br><span itemprop="name" class="p-name fn n"><span itemprop="givenName" class="p-given-name given-name">Chris</span><br><span itemprop="familyName" class="p-family-name family-name">Siebenmann</span></span></a></span> describes this in more detail in <cite><a href="https://utcc.utoronto.ca/~cks/space/blog/web/AWebColoursProblem">AWebColours­Problem</a></cite>. In short: when setting colors, always set both the foreground and the background color. Don’t set just one of the two.</p><p>Chris also describes the importance of visited link colors in <cite><a href="https://utcc.utoronto.ca/~cks/space/blog/web/RealBlogUsability">RealBlogUsability</a></cite>.</p><h3 id="color-overrides-and-accessibility">Color overrides and accessibility</h3><p>Even if you set custom colors, ensure that the page is compatible with color overrides: elements shouldn’t be distinguished solely by foreground and background color. <a href="https://www.w3.org/WAI/WCAG22/Techniques/css/C25">Technique C25</a> for the <cite>Web Content Accessibility Guidelines (<abbr title="Web Content Accessibility Guidelines">WCAG</abbr>)&nbsp;2.2</cite> describes how doing so can meet the WCAG&nbsp;2.2’s <a href="https://www.w3.org/WAI/WCAG22/Understanding/visual-presentation">Success Criterion&nbsp;1.4.8</a>. Specifically, it describes using default colors in combination with visible borders. The latter helps distinguish elements from surrounding content without relying on a custom color palette.</p><p>This page’s <a href="https://seirdy.one/2020/11/23/website-best-practices.html">canonical location</a> is an example application of Technique C25 (and the related <a href="https://www.w3.org/WAI/WCAG22/Techniques/general/G148">Technique G148</a>). It only uses non-default colors when a user agent requests a dark color scheme (using the <code>prefers-color-scheme</code> CSS media query; see the next subsection) and for lightening borders. Any image with a solid background may match the page background; to ensure that their dimensions are clear, I surrounded them with borders. I also set a custom color for the borders and ensure that the image backgrounds don’t match the border colors. I included horizontal rules (<code>&lt;hr&gt;</code>) further down to break up next/prev post navigation as well as separate footers, since these elements lack heading-based delineation. When overriding color schemes or disabling CSS altogether, the page layout remains clear.</p><p>The aforementioned techniques ensure a clear page layout independently of color scheme.</p><h3 id="dark-themes">Dark themes</h3><p>If you do explicitly set colors, please also include a dark theme using a media query: <code>@media (prefers-color-scheme: dark)</code>. For more info, read the relevant docs <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme">on MDN</a></p><p>When setting colors, especially with a dark background, I recommend checking your page’s contrast using Advanced Perceptual Contrast Algorithm (<abbr title="Advanced Perceptual Contrast Algorithm">APCA</abbr>) values. You can do so in an <a href="https://uglyduck.ca/lazy-dev-dark-mode/">online checker</a> or Chromium’s developer tools (you might have to enable them in a menu for experimental preferences). Blue and purple links on a black background have much worse perceptual contrast than yellow or green links.</p><p>Note that the APCA isn’t fully mature as of early 2022. Until version 3.0 of the WCAG is ready, pages should also conform to the contrast ratios described in the WCAG&nbsp;2.2’s success criterions 1.4.3 (Contrast: Minimum, level AA) or 1.4.6 (Contrast: Enhanced, level AAA).</p><p>CSS filters such as <code>invert</code> are expensive to run, so use them sparingly. Simply inverting your page’s colors to provide a dark theme could slow it down or cause a user’s fans to spin.</p><p>Darker backgrounds draw less power on devices with OLED screens; however, backgrounds should never be solid black. White text on a black background causes halation, esp. for readers who have astigmatism. There has been some <a href="https://www.laurenscharff.com/research/AHNCUR.html">experimental</a> and plenty of <a href="https://jessicaotis.com/academia/never-use-white-text-on-a-black-background-astygmatism-and-conference-slides/">anecdotal</a> evidence to support this. I personally like a foreground and background of <code>#ececec</code> and <code>#0c0c0c</code>, respectively. These shades seem to be as far apart as possible without causing accessibility issues: <code>#0c0c0c</code> is barely bright enough to create a soft “glow” capable of minimizing halos.</p><p>If you can’t bear the thought of parting with your solid-black background, worry not: there exists a CSS media feature and client-hint for contrast preferences called <code>prefers-contrast</code>. It takes the parameters <code>no-preference</code>, <code>less</code>, and <code>more</code>. You can serve increased-contrast pages to those who request <code>more</code>, and vice versa. Check <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-contrast">prefers-contrast on MDN</a> for more information.</p><h2 id="image-optimization">Image optimiza­tion</h2><p>Some image optimization tools I use:</p><ul><br><li><a href="https://pngquant.org/"><code>pngquant</code></a> (lossy)</li><li><a href="https://github.com/shssoichiro/oxipng"><code>oxipng</code></a> (lossless)</li><li><a href="https://github.com/tjko/jpegoptim"><code>jpegoptim</code></a> (lossless or lossy)</li><li><a href="https://developers.google.com/speed/webp/docs/cwebp"><code>cwebp</code></a> (lossless or lossy)</li><li><code>avifenc</code> (lossless or lossy), included in <a href="https://github.com/AOMediaCodec/libavif">libavif</a></li></ul><p>I put together a <a href="https://git.sr.ht/~seirdy/dotfiles/tree/3b722a843f3945a1bdf98672e09786f0213ec6f6/Executables/shell-scripts/bin/optimize-image">quick script</a> to losslessly optimize images using these programs in my dotfile repo.</p><p>You also might want to use the HTML <code>&lt;picture&gt;</code> element, using JPEG/PNG as a fallback for more efficient formats such as WebP or AVIF. More info in the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture">MDN docs</a></p><p>Most of my images will probably be screenshots that start as PNGs. My typical flow:</p><ol><br><li>Re-size and crop the image. Convert to grayscale if colors aren’t important.</li><li>Lossy compression with <code>pngquant</code></li><li>Losslessly optimize the result with <code>oxipng</code> and its Zopfli backend (slow)</li><li>Also create a lossless WebP from the lossy PNG and a lossy WebP from the source image, using <code>cwebp</code>. Pick the smaller of the two.</li><li>Include the resulting WebP in the page, with a fallback to the PNG using a <code>&lt;picture&gt;</code> element.</li><li>Create a lossy AVIF image from the original source image, and include it in the <code>&lt;picture&gt;</code> element if it’s smaller than the WebP.</li><li>If the image is too light, repeat for a dark version of the image to display with a <code>prefers-dark-mode</code> media query.</li></ol><figure><br><figcaption><br><p>This is a sample command to compress a PNG image using ImageMagick, <code>pngquant</code>, and <code>oxipng</code>. It shrinks the image, turns it grayscale, reduces the color palette, and then applies lossless Zopfli compression:</p></figcaption><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">convert -resize 75% original.png -colorspace GRAY -format png - <span class="se">\<br></span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> pngquant -s <span class="m">1</span> <span class="m">12</span> - <span class="se">\<br></span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="p">|</span> oxipng -o max -Z --fix - --out compressed.png<br></span></span></code></pre></div></figure><p>It might seem odd to create a lossless WebP from a lossy PNG, but I’ve found that it’s often the best way to get the smallest possible image at the minimum acceptable quality for screenshots with solid backgrounds.</p><p>In general, avoid using inline images just for decoration. Only use an image if it has a clear purpose that significantly adds to the content in a way that text can’t replace, and provide alt-text as a fallback. Any level of detail that isn’t necessary for getting the point across should be removed with lossy compression and cropping. Some conventional wisdom for image compression doesn’t hold up when compressing this aggressively; for instance, I’ve found that extremely aggressive dithering and PNG compression of small black-and-white images consistently surpasses JPEG compression.</p><p>If you want to include a profile photo (e.g., if your website is part of the IndieWeb), I recommend re-using one of your favicons. Doing so should be harmless since most browsers will fetch and cache favicons anyway.</p><p>If you really want to go overboard with PNG optimization, you can try a tool like <a href="https://github.com/fhanau/Efficient-Compression-Tool">Efficient Compression Tool</a>.</p><h3 id="dark-image-variants">Dark image variants</h3><p>A <code>&lt;picture&gt;</code> element allows selection of sources based on any CSS media query. When images have light backgrounds, I like to include dark variants too.</p><figure><br><figcaption><br>A minimal example of a <code>picture</code> with a dark variant:<br></figcaption><pre tabindex="0"><code>&lt;source type=image/png<br> srcset=/p/dark.png<br> media="screen and (prefers-color-scheme: dark)"&gt;<br>&lt;source type=image/png<br> srcset=/p/light.png&gt;<br></code></pre></figure><p>Requiring the <code>screen</code> media type prevents selection of dark variants when printing. Printer paper is almost always white, so dark images could waste ink. Ink waste is a sensitive issue among many students: school printers sometimes charge students who exceed a given ink quota. Ask me how I know!</p><p>Light and dark variants of legacy formats (PNG, JPG, GIF), WebP, and AVIF can cause some of my <code>&lt;picture&gt;</code> imagesets to have up to six image variants. I could fully automate the process using my static site generator (Hugo) if I wanted to. Since I do want to inspect each image and compress to the minimum acceptable quality, I settled for partial automation using shell scripts and <a href="https://git.sr.ht/~seirdy/seirdy.one/tree/master/layouts/shortcodes/picture.html">a Hugo shortcode</a>.</p><h3 id="svg-images">SVG images</h3><p>I only recommend using SVG in images, not embeds/objects or directly in the body. Remember that users may save images and open them in a non-browser image viewer with reduced SVG compatibility. To maintain maximum compatibility, stick to the subset of <a href="https://www.w3.org/TR/SVG11/feature#SVG-static">SVG Static</a>’s <a href="https://www.w3.org/TR/SVG/conform.html#secure-static-mode">secure static processing mode</a> that appears in the <a href="https://datatracker.ietf.org/doc/draft-svg-tiny-ps-abrotman/">SVG Tiny Portable<wbr>/Secure (<abbr title="Portable/Secure">PS</abbr>)</a> spec. SVG PS is a subset of <a href="https://www.w3.org/TR/SVGTiny12/intro.html">SVG Tiny 1.2</a>, which is a supported export format in most vector drawing programs. Ignore the elements specifically required for SVG Tiny PS; your image can be a standard SVG that only utilizes a tiny subset of the full SVG spec.</p><p>The above advice might seem daunting, but it’s usually easy to use existing tools to generate an SVG Tiny file and manually edit it to support the SVG secure static mode. SVGs that conform to this subset should be compatible with Qt5’s SVG implementation, librsvg (used by Wikipedia and GNOME), and most operating systems’ icon renderers.</p><p>Two tools that can optimize the size of an SVG file are <a href="https://github.com/svg/svgo">SVGO</a> and the now-discontinued <a href="https://github.com/RazrFalcon/svgcleaner">svgcleaner</a>. Don’t overdo lossy compression with these tools, since lossy compression can sometimes <em>reduce</em> the effectiveness of gzip and Brotli compression.</p><h2 id="layout">Layout</h2><p>This is possibly the most subjective item I’m including, and the item with the most exceptions. Consider it more of a weak suggestion than hard advice. Use your own judgement.</p><p>The first or second heading in the DOM, and the highest heading level, should be the page title marking the start of your main content (i.e. it should come after the site title, site navigation links, etc). Only if this is impossible should you consider adding a “skip link” instead. Visually-impaired users generally prefer navigating by headings.</p><p>A simple layout looks good at a variety of window sizes, rendering responsive layout changes unnecessary. Textual websites really don’t need more than a single column; readers should be able to scan a page top-to-bottom, left-to-right (or right-to-left, depending on the locale) exactly once to read all its content. Verify this using the horizontal-line test: mentally draw a horizontal line across your page, and make sure it doesn’t intersect more than one (1) item. Keeping a single-column layout that doesn’t require responsive layout changes ensures smooth window re-sizing.</p><p>Exceptions exist: one or two very simple responsive changes won’t hurt. The main anti-patterns are adjusting the relative order of elements, and layout shifts dramatic enough to cause confusion.</p><figure><br><figcaption><br><p>The only responsive layout change on <a href="https://seirdy.one/">my website</a> is a single CSS declaration to switch between inline and multi-line navigation links at the top of the page:</p></figcaption><pre tabindex="0"><code>@media (min-width: 32rem) {<br> nav li {<br> display: inline;<br> }<br>}<br></code></pre></figure><p>Nontrivial use of width-selectors, in CSS or imagesets, is actually a powerful vector for <a href="https://matt.traudt.xyz/posts/2016-09-04-how-css-alone-can-help-track-you/">JS-free fingerprinting</a>. This is one of the reasons why I didn’t recommend resolution- or dimension-aware imagesets in the <a href="https://seirdy.one/2020/11/23/website-best-practices.html#image-optimization">image optimization section</a>.</p><p>Achieving this type of layout entails using the WCAG&nbsp;2.2 techniques <cite><a href="https://www.w3.org/WAI/WCAG22/Techniques/css/C27.html">C27: Making the DOM order match the visual order</a></cite> as well as <cite><a href="https://www.w3.org/WAI/WCAG22/Techniques/css/C6">C6: Positioning content based on structural markup</a></cite>.</p><h3 id="what-about-sidebars">What about sidebars?</h3><p>Sidebars are probably unnecessary, and can be quite annoying to readers who re-size windows frequently. This is especially true for tiling window manager users like me: we frequently shrink windows to a fraction of their original size. When this happens on a website with a sidebar, one of two things happens:</p><ol><br><li>The site’s responsive design kicks in: the sidebar vanishes and its elements move elsewhere. This can be quite CPU-heavy, as the browser has to both re-wrap the text <em>and</em> handle a complex layout change. Frequent window re-sizers will experience lag and battery loss, and might need a moment to figure out where everything went.</li><li>The site doesn’t use responsive design. The navbar and main content are now squeezed together. Readers will probably close the page.</li></ol><p>Neither situation looks great.</p><h3 id="sidebar-alternatives">Sidebar alternatives</h3><p>Common items in sidebars include tag clouds, an author bio, and an index of entries; these aren’t useful while reading an article. Consider putting them in the article footer or–even better–dedicated pages. This does mean that readers will have to navigate to a different page to see that content, but they probably prefer things that way; almost nobody who clicked on “An opinionated list of best practices for textual websites” did so because they wanted to read my bio.</p><p>Don’t boost engagement by providing readers with information they didn’t ask for; earn engagement with good content, and let readers navigate to your other pages <em>after</em> they’ve decided they want to read more.</p><h2 id="narrow-viewports">Narrow viewports</h2><p>A single element wider than the viewport will trigger horizontal scrolling for the entire page. This is especially problematic for long pages that require excessive scrolling.</p><p>Not every phone has a giant screen: millions of people around the world use Web-enabled feature phones. The Jio Phone&nbsp;2, for instance, sports a 6&nbsp;cm (2.4&nbsp;inch) screen that’s 240 pixels wide. Furthermore, some programs sport browser windows in sidebars (c.f. Mozilla’s <a href="https://addons.mozilla.org/en-US/firefox/addon/side-view/">side view</a>, Vivaldi <a href="https://help.vivaldi.com/desktop/panels/web-panels/">Web Panels</a>). Users who leverage floating or tiling windows rather than maximizing everything could use viewports of arbitrary dimensions.</p><p>Long words, especially in headings, can trigger horizontal overflow. Test in a viewport that’s under 240 pixels wide (<abbr title="Device Pixel Ratio">DPR</abbr>=1) and observe any words that trail off of the edge of the screen. Add soft hyphens to these words using the <code>&amp;shy;</code> entity. Prefer breaking off suffixes ("-ing", “-ed”, etc).</p><p>Most modern browsers support the <code>hyphens</code> CSS3 property, but full automatic hyphenation is an overkill solution with a naive implementation. Automatic hyphenation will insert hyphens wherever it can, not necessarily between the best syllables. At the time of writing, humans are still better at hyphenating than most software implementations. I’m also not aware of a CSS property that only breaks syllables when necessary to avoid horizontal scrolling.</p><p>Users employing machine translation will not benefit from your soft hyphens, so don’t expect them to always work as intended. Translation tools might also replace short words with long ones. Soft hyphens and automatic hyphenation are both flawed solutions, but I find soft hyphens to be less problematic.</p><p>Where long inline <code>&lt;code&gt;</code> elements can trigger horizontal scrolling, consider a scrollable <code>&lt;pre&gt;</code> element instead. Making a single element scrollable in two dimensions is far better than doing so for the whole page.</p><h3 id="indented-elements">Indented elements</h3><p>Most browser default stylesheets were not optimized for narrow viewports, so narrow-viewport optimization is one of few good reasons to override the defaults. The best example of widescreen bias in browser stylesheets is indentation.</p><p>The HTML standard’s section 4.4.4 <a href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-blockquote-element">covers blockquotes</a>. It recommends placing a <code>&lt;blockquote&gt;</code> element inside a <code>&lt;figure&gt;</code> and citations in a <code>&lt;figcaption&gt;</code> to show a semantic relationship between a quotation and its citation.</p><p>Browser default stylesheets typically give <code>&lt;figure&gt;</code> elements extra margins on the left and right. <code>&lt;blockquote&gt;</code> elements have a large indent. Combining these two properties gives the final quotation an excessive visual indent, wasting precious vertical screen space. When such a blockquote contains <code>&lt;ol&gt;</code> or <code>&lt;ul&gt;</code> elements, the indentation alone may fill most of a narrow viewport!</p><p>I chose to remove the margins in <code>&lt;figure&gt;</code> elements. I don’t find the margins useful because I typically use them to annotate non-centered phrasing content, such as <code>&lt;blockquote&gt;</code> and <code>&lt;pre&gt;</code> elements, and my image-based figures tend to have longer captions. If you’re reading this page with its own stylesheet enabled, in a CSS&nbsp;2 compliant browser, you might have noticed the blockquotes on it are formatted with a minimal indent and a thick gray border on the left rather than a full indent. These two adjustments allow blockquotes containing bulleted lists to fit on most narrow viewports, even when wrapped by a <code>&lt;figure&gt;</code> element.</p><h2 id="tor">Tor</h2><p>Many people use Tor out of necessity. On Tor, additional constraints apply.</p><p>For one, Tor users are encouraged to set the Tor Browser Bundle’s (<abbr title="Tor Browser Bundle">TBB</abbr>) <a href="https://tb-manual.torproject.org/en-US/security-settings/">security settings</a> to “safest”. This disables scripts, MathML, some fonts, SVG images, and <a href="https://gitweb.torproject.org/torbutton.git/tree/modules/security-prefs.js">other features</a>. If your site has any SVG images, the Tor browser will download these just like Firefox would (to avoid fingerprinting) but will not render them.</p><p>Additionally, hopping between nodes in Tor circuits incurs latency, worsening the impacts of requiring multiple requests and round-trips. Try to minimise the number of requests to view a page.</p><p>If you use a CDN or some overcomplicated website security stack, make sure it doesn’t block Tor users or require them to enable JavaScript to complete a CAPTCHA. Tor Browser users are supposed to avoid fingerprinting vectors like JS and browser extensions, so requiring a JavaScript-based CAPTCHA will effectively block many Tor users.</p><p>To go above and beyond, try mirroring your site to an onion service to reduce the need for exit nodes. Mirroring allows you to keep a separate version of your site optimized for the Tor browser. Normally, optimizing specifically for a given user agent’s quirks is a bad practice; however, the Tor Browser is a special case because it sometimes pretends to have Firefox’s capabilities. Progressive enhancement and graceful degradation won’t work.</p><p>For example, my website’s clearnet version uses some SVG images. Some browsers can’t handle a given image format. The typical solution is to use a <code>&lt;picture&gt;</code> element containing <code>&lt;source&gt;</code> children with varying formats and a fallback <code>&lt;img&gt;</code> element using a legacy image format.</p><p>The Tor browser will download whichever format Firefox would, rather than whichever formats it actually supports. A <code>&lt;picture&gt;</code> element containing an SVG and a raster fallback won’t help: the Tor browser will avoid fingerprinting by selecting the SVG format, not a fallback format. The image will not be rendered, so users will have downloaded the image only to see a white box.</p><p>I address the issue by not using any SVG images on <a href="http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/">my hidden service</a>.</p><h2 id="optimal-loading">Optimal loading</h2><p>Lightweight content isn’t the only factor for optimizing load times. There are ways to optimize loading without a <abbr title="Content Delivery Network">CDN</abbr>.</p><h3 id="blocking-resources">Blocking resources</h3><p>HTML is a blocking resource: images and stylesheets will not load until the user agent loads and parses the HTML that calls them. To start loading above-the-fold images before the HTML parsing finishes, send a <code>link</code> HTTP header.</p><figure><br><figcaption><br><p>My website includes a <code>link</code> header to load an SVG that serves as my IndieWeb photo and favicon:</p></figcaption><pre tabindex="0"><code>link: &lt;/favicon.072dbf7bc4323646b9ee96243fbd71b2.svg&gt;; rel=preload; as=image<br></code></pre></figure><p>Reducing load time is especially useful for users with unreliable connections. For much of the world, connectivity comes in short bursts during which loading time is precious. Chances of a connection failure or packet loss increase with time.</p><h3 id="inline-content">Inline content</h3><p>In addition to HTML, CSS is also a blocking resource. You could pre-load your CSS using a <code>link</code> header. Alternatively: if your CSS is under a kilobyte, consider inlining it in the <code>&lt;head&gt;</code> using a <code>&lt;style&gt;</code> element. Simply inlining stylesheets can pose a security threat, but the <code>style-src</code> <abbr title="Content Security Policy">CSP</abbr> directive can mitigate this if you include a hash of your inline stylesheet.</p><p>You can do the same with images by using a <code>data:</code> URI; my 32-pixel PNG site icon is under 200 bytes and inlines quite nicely. On this site’s hidden service, it’s often the only image on a page (recall that the hidden service replaces SVGs with PNGs). Inlining this image and the stylesheet allows my hidden service’s homepage to load in a single request, which is a welcome improvement given the round-trip latency that plagues onion routing implementations.</p><h3 id="layout-shifts">Layout shifts</h3><p>Loading content with unknown dimensions, such as images, can create layout shifts; the <abbr title="Web Incubator Community Group">WICG</abbr>’s <cite><a href="https://wicg.github.io/layout-instability/#sec-intro">Layout Instability API</a></cite> describes the phenomenon in detail. Avoid layout shifts by including dimensions in HTML attributes. The simplest way to do so is by including <code>width</code> and <code>height</code> values, but the <code>style</code> attribute could work too. I recommend staying away from the <code>style</code> attribute, or at least selectively allowing its use with the <code>style-src-attr</code> CSP directive.</p><h3 id="other-server-side-tweaks">Other server-side tweaks</h3><p>In-depth server configuration is a bit out of scope, so I’ll keep this section brief.</p><p>Compression–especially static compression–dramatically reduces download sizes. My full-text RSS feed is about a quarter of a megabyte, but the Brotli-compressed version is around 70 kilobytes. Caddy supports this with a <code>precompressed</code> directive; Nginx requires a <a href="https://github.com/google/ngx_brotli">separate module</a>.</p><p>When serving many resources at once (e.g., if a page has many images), HTTP/2 could offer a speed boost through multiplexing. HTTP/3 is unlikely to help textual websites much, so run a benchmark to see if it’s worthwhile.</p><h2 id="non-browsers-reading-mode">Non-Browsers: Reading mode</h2><p>Fully standards-compliant browsers aren’t the only programs people use. They also use “reading mode” tools and services.</p><p>Reading modes leverage article extractors such as <a href="https://github.com/mozilla/readability">Readability</a> (integrated into Firefox, Epiphany, Brave, Vivaldi, and others), <a href="https://chromium.googlesource.com/chromium/dom-distiller/">DOM Distiller</a> (integrated into Chromium), and <a href="https://trafilatura.readthedocs.io/en/latest/">Trafilatura</a> (powers a variety of tools and services). A host of other proprietary options exist: Diffbot powers services like Instapaper, Mozilla’s Pocket has its own secret parsers, and countless “send to e-reader” services have amassed loyal users. Safari’s proprietary fork of Readability has grown quite complex compared to upstream.</p><p>I don’t recommend catering to each tool’s non-standard quirks. Studying their design reveals that they observe open standards, to varying degrees. Readability, DOM Distiller, and Trafilatura understand plain-old, semantic HTML (<abbr title="Plain-Old, Semantic HTML">POSH</abbr>).</p><p>POSH should be enough for most use-cases, but some authors want to go further. For example, they may want a byline or published date to show up in these modes.</p><p>Most extractors fetch these values using open standards for structured data. The most well-supported option is <a href="https://microformats.org/wiki/microformats">microformats</a> (Readability is one of the few that supports the newer microformats2). Some support <a href="https://schema.org/">schema.org</a> vocabularies in Microdata or JSON-LD syntaxes, or <a href="https://www.dublincore.org/">Dublin Core</a> vocabularies in RDFa. Most parse <code>&lt;meta&gt;</code> tags from the document <code>&lt;head&gt;</code>, but others don’t due to misuse and overly aggressive <abbr title="Search Engine Optimization">SEO</abbr>.</p><p>Sorry, that was a lot of jargon for a single paragraph. Unfortunately, describing those terms is out of scope for this post. If you’d like to dive down this rabbit hole, read about the “Semantic Web”.</p><p>Again: avoid catering to non-standard implementations’ quirks, especially undocumented proprietary ones. Let’s not repeat the history of the <a href="https://en.wikipedia.org/wiki/Browser_wars">browser wars</a>. More information about standard and non-standard behavior of reading modes is in the article <cite><a href="https://www.ctrl.blog/entry/browser-reading-mode-parsers.html">Web Reading Mode: The non-standard rendering mode</a></cite> by <span itemscope="" itemtype="https://schema.org/Person" class="h-card vcard"><br><a itemprop="url" href="https://www.daniel.priv.no/" class="u-url url"><br><span itemprop="name" class="p-name fn n"><span itemprop="givenName" class="p-given-name given-name">Daniel</span><br><span itemprop="familyName" class="p-family-name family-name">Aleksandersen</span></span></a></span>.</p><p>Reading modes aren’t the only non-browser user agents out there. Plain-text feed readers and link previewers are some other options. I singled out reading modes because of their widespread adoption and value. Decide which other kinds of agents are important to you (if any), and see if they expose a hole in your semantics.</p><h2 id="testing">Testing</h2><p>If your site is simple enough, it should automatically handle the vast majority of edge-cases. Different devices and browsers all have their quirks, but they generally have one thing in common: they understand <abbr title="Plain-Old, Semantic HTML">POSH</abbr>.</p><p>In addition to standard testing, I recommend testing with unorthodox setups that are unlikely to be found in the wild. If a website doesn’t look good in one of these tests, there’s a good chance that it uses an advanced Web feature that can serve as a point of failure in other cases. Simple sites should be able to look good in a variety of situations out of the box.</p><p>Your page should easily pass the harshest of tests without any extra effort if its HTML meets basic standards for well-written code (overlooking bad formatting and a lack of comments). Even if you use a complex static site generator, the final HTML should be simple, readable, and semantic.</p><h3 id="sample-unorthodox-tests">Sample unorthodox tests</h3><p>These tests start out pretty reasonable, but gradually get more ridiculous. Once again, use your judgement.</p><ol><br><li>Evaluate the heaviness and complexity of your scripts (if any) by testing with your browser’s <abbr title="just-in-time">JIT</abbr> compilation disabled.<sup id="fnref:4"><a href="https://seirdy.one/2020/11/23/website-best-practices.html#fn:4" class="footnote-ref" role="doc-noteref">4</a></sup></li><li>Test using the Tor browser with the safest security level enabled (disables JS, SVG, and other features).</li><li>Load just the HTML. No CSS, no images, etc. Try loading without inline CSS as well for good measure.</li><li>Print out the site in black-and-white, preferably with a simple laser printer.</li><li>Test with a screen reader.</li><li>Test keyboard navigability with the <kbd>TAB</kbd> key. Even without specifying tab indexes, tab selection should follow a logical order if you keep the layout simple.</li><li>Test in textual browsers: lynx, links, w3m, ELinks, edbrowse, EWW, Netrik, etc.</li><li>Read the (prettified and indented) HTML source itself and parse it with your brain. See if anything seems illogical or unnecessary. Imagine giving someone a printout of your page’s <code>&lt;body&gt;</code> along with a whiteboard. If they have a basic knowledge of HTML tags, would they be able to draw something resembling your website?</li><li>Test in an online website translator tool.</li><li>Test on something ridiculous: try your old e-reader’s embedded browser, combine an HTML-to-EPUB converter and an EPUB-to-PDF converter, or stack multiple article-extraction utilities on top of each other. Be creative and enjoy breaking your site. When something breaks, examine the breakage and see if you can fix it by simplifying your page.</li><li>Build a time machine. Travel decades–or perhaps centuries–into the future. Keep going forward until the WWW is breathing its last breath. Test your site on future browsers. Figuring out how to transfer your files onto their computers might take some time, but you have a time machine so that shouldn’t be too hard. When you finish, go back in time to <a href="https://xkcd.com/567/">meet Benjamin Franklin</a>.</li></ol><p>I’m still on step 10, trying to find new ways to break this page. If you come up with a new test, please <a href="mailto:~seirdy/seirdy.one-comments@lists.sr.ht">share it</a>.</p><h2 id="in-defense-of-link-underlines">In defense of link underlines</h2><p>Some typographers insist that <a href="https://practicaltypography.com/underlining.html">underlined on-screen text is obsolete</a>, and hyperlinks are no exception. I disagree.</p><p>One reason is that underlines make it easy to separate multiple consecutive inline links:</p><picture><br><source srcset="/p/underlines_dark.613e65cf51a357718d3f834585f77710.webp" type="image/webp" media="screen and (prefers-color-scheme: dark)"><br><source srcset="/p/underlines_dark.a8c58da0dcdf9ea7b3040061ccbf5b7b.png" type="image/png" media="screen and (prefers-color-scheme: dark)"><br><source srcset="/p/underlines.f68365f7536aca51a2d1e3e6307d7afc.webp" type="image/webp"><br><source srcset="/p/underlines.719b1c5a3501f442f179278534695590.png" type="image/png"><br><img width="523" height="117" src="https://seirdy.one/p/underlines.png" alt="two lines with two consecutive hyperlinks each, one line with and one without underlines" decoding="async"><br></picture><br><p>Underlines also make it easy for readers with color vision deficiencies to distinguish the beginnings and ends of links from surrounding text. A basic WCAG Level A requirement is for information to not be conveyed solely through color:</p><figure itemscope="" itemtype="https://schema.org/Quotation"><br><blockquote><br><p>Color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. (Level A)</p></blockquote><figcaption class="h-cite" itemprop="citation"><br>— <cite itemprop="isPartOf" itemscope="" itemtype="https://schema.org/CreativeWork"><a class="u-url p-name" itemprop="url" href="https://www.w3.org/TR/WCAG22/"><span itemprop="name">WCAG&nbsp;2.2</span></a></cite>, <a href="https://www.w3.org/TR/WCAG22/#distinguishable">section 1.4.1</a><br></figcaption></figure><p>Readers already expect underlined text to signify a hyperlink. Don’t break fundamental affordances for aesthetics.</p><h2 id="other-places-to-check-out">Other places to check out</h2><p>This page can be thought of as an extension of the principles of Brutalist Web Design:</p><figure itemscope="" itemtype="https://schema.org/Quotation"><br><blockquote><br><ul><br><li>Content is readable on all reasonable screens and devices.</li><li>Only hyperlinks and buttons respond to clicks.</li><li>Hyperlinks are underlined and buttons look like buttons.</li><li>The back button works as expected.</li><li>View content by scrolling.</li><li>Decoration when needed and no unrelated content.</li><li>Perform­ance is a feature.</li></ul></blockquote><figcaption class="h-cite" itemprop="citation"><br>— <span itemscope="" itemtype="https://schema.org/Person" class="h-card vcard"><br><a itemprop="url" href="https://naildrivin5.com/" class="u-url url"><br><span itemprop="name" class="p-name fn n"><span itemprop="givenName" class="p-given-name given-name">David</span><br><span itemprop="familyName" class="p-family-name family-name">Copeland</span></span></a></span>, <cite itemprop="isPartOf" itemscope="" itemtype="https://schema.org/CreativeWork"><a class="u-url p-name" itemprop="url" href="https://brutalist-web.design/"><span itemprop="name">Brutalist Web Design</span></a></cite><br></figcaption></figure><p>The <a href="https://250kb.club/">250kb club</a> gathers websites at or under 250kb, and also rewards websites that have a high ratio of content size to total size.</p><p>The <a href="https://10kbclub.com/">10KB Club</a> does the same with a 10kb homepage budget (excluding favicons and webmanifest icons). It also has guidelines for noteworthiness, to avoid low-hanging fruit like mostly-blank pages.</p><p>My favorite website club has to be the <a href="https://xhtml.club/"><abbr title="eXtreme HyperText Movement for Luddites">XHTML</abbr> Club</a> by <span itemscope="" itemtype="https://schema.org/Person" class="h-card vcard"><br><a itemprop="url" href="https://tdarb.org/" class="u-url url"><br><span itemprop="name" class="p-name fn n"><span itemprop="givenName" class="p-given-name given-name">Bradley</span><br><span itemprop="familyName" class="p-family-name family-name">Taunt</span></span></a></span>, the creator of the original <a href="https://1mb.club/">1mb.club</a>.</p><p>Also see <a href="https://motherfuckingwebsite.com/">Motherfucking Website</a>. Motherfucking Website inspired several unofficial sequels that tried to gently improve upon it. My favorite is <a href="https://bestmotherfucking.website/">Best Motherfucking Website</a>.</p><p>The <a href="https://www.webbloatscore.com/">WebBS calculator</a> compares a page’s size with the size of a PNG screenshot of the full page content, encouraging site owners to minimize the ratio of the two.</p><p>One resource I found useful (that eventually featured this article!) was the “Your page content” section of <span itemscope="" itemtype="https://schema.org/Person" class="h-card vcard"><br><a itemprop="url" href="https://www.billdietrich.me/" class="u-url url"><br><span itemprop="name" class="p-name fn n"><span itemprop="givenName" class="p-given-name given-name">Bill</span><br><span itemprop="familyName" class="p-family-name family-name">Dietrich</span></span></a></span>’s comprehensive guide to <a href="https://www.billdietrich.me/YourPersonalWebSite.html#PageContent">setting up your personal website</a>.</p><p>If you’ve got some time on your hands, I <em>highly</em> recommend reading the <cite><a href="https://www.w3.org/TR/WCAG22/">Web Content Accessibility Guidelines (WCAG)&nbsp;2.2</a></cite>. The WCAG 2 standard is technology-neutral, so it doesn’t contain Web-specific advice. For that, check the <cite><a href="https://www.w3.org/WAI/WCAG22/quickref">How to Meet WCAG (Quick Reference)</a></cite>. It combines the WCAG with its supplementary <a href="https://www.w3.org/WAI/WCAG22/Techniques/">list of techniques</a>.</p><section class="footnotes" role="doc-endnotes" aria-labelledby="note-hd"><br><h2 id="note-hd">Notes</h2><ol><br><li id="fn:1" role="doc-endnote"><br><p>Many addons function by injecting content into pages; this significantly weakens many aspects of the browser security model (e.g. site and origin isolation) and should be avoided if at all possible. On sensitive pages with content such as public key fingerprints, I recommend setting a blank <code>sandbox</code> directive even if it means breaking these addons.&nbsp;<a href="https://seirdy.one/2020/11/23/website-best-practices.html#fnref:1" class="footnote-backref" role="doc-backlink">↩︎</a></p></li><li id="fn:2" role="doc-endnote"><br><p>Some addons will have reduced functionality; for instance, <a href="https://github.com/tridactyl/tridactyl">Tridactyl</a> can’t create an <code>&lt;iframe&gt;</code> for its command window. I consider this to be worthwhile since the most important functionality is still available, and because authors shouldn’t feel compelled to support security weakening. I say this as someone who uses Tridactyl often.&nbsp;<a href="https://seirdy.one/2020/11/23/website-best-practices.html#fnref:2" class="footnote-backref" role="doc-backlink">↩︎</a></p></li><li id="fn:3" role="doc-endnote"><br><p>Here’s an <a href="https://en.wikipedia.org/wiki/Progressive_enhancement">overview of PE</a> and <a href="https://whalecoiner.com/articles/progressive-enhancement">my favorite write-up on the subject</a>.&nbsp;<a href="https://seirdy.one/2020/11/23/website-best-practices.html#fnref:3" class="footnote-backref" role="doc-backlink">↩︎</a></p></li><li id="fn:4" role="doc-endnote"><br><p>Consider disabling the JIT for your normal browsing too; doing so removes whole classes of vulnerabilities. In Firefox, navigate to <code>about:config</code> and toggle these options:</p><pre>javascript.options.ion<br>javascript.options.baselinejit<br>javascript.options.native_regexp<br>javascript.options.asmjs<br>javascript.options.wasm</pre>In Chromium and derivatives, run the browser with <code>--js-flags='--jitless'</code>; in the Tor Browser, set the security level to “Safer”.&nbsp;<a href="https://seirdy.one/2020/11/23/website-best-practices.html#fnref:4" class="footnote-backref" role="doc-backlink">↩︎</a><p></p></li></ol></section>
byRohan Kumar • posted archived copycurrent