Death to px, long live ch

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:

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.

Why it deserves more upvotes: A crisp argument for a CSS unit that solves a real readability problem, from a writer who consistently gets web standards right.

All newsletters