2026-08-23
Link: https://shkspr.mobi/blog/2026/08/death-to-px-long-live-ch/
HN Discussion: 2 points, 0 comments
Terence Eden's blog (shkspr.mobi) is a reliable source of sharp, opinionated web-standards writing, and this post lands on one of the most under-appreciated CSS units in the spec: ch. Most front-end developers reach reflexively for pixels — or, if they're feeling modern, rem — when sizing content containers. But neither unit expresses what we actually care about when laying out prose: how many characters fit on a line.
The ch unit is defined as the advance width of the "0" glyph in the current font. That means max-width: 65ch gives you a column roughly 65 characters wide, regardless of font-size, zoom level, or user font preferences. This maps directly onto a century of typographic research: readable line length sits between 45 and 75 characters. Every time you hardcode max-width: 800px on an article container, you're guessing at that number through a lossy translation layer.
Why this deserves a technical audience's attention:
ch-based layout respects the user's font-size settings and stays legible at 200% browser zoom. Pixel layouts routinely break at accessibility zoom levels because they were sized against an assumed default.clamp() and viewport units, ch lets you build layouts that adapt to both the reader's viewport and their chosen font size — the two axes that matter for reading.ch is often the correct primitive for text-bearing components, while rem stays right for UI chrome.The caveats are worth knowing too. ch is font-dependent, so a column measured in ch against a monospace font will differ dramatically from the same value against a proportional font — which is actually the point, but surprises people. And in variable-width fonts, the "0" width is only an approximation of the average character width. For hard constraints, the newer ic and rex units offer more precision.
This kind of small, well-argued post is exactly what HN used to surface reliably. It's not a framework announcement or a launch, but it changes how you write CSS tomorrow — which is a better ROI than most of what trends on the front page.
