DEV Community

BM lm
BM lm

Posted on

Accessible typography is mostly CSS you already know

Accessibility audits love to flag typography, and the fixes are embarrassingly simple. Here is the whole checklist, with the CSS that implements it.

Size: never below 16px for body text

body { font-size: 16px; } and use rem everywhere else so user preferences cascade. Users who set a larger browser default deserve a page that respects it.

Contrast: the font weight trap

Light weights (300 and below) on light backgrounds fail WCAG contrast even in pure black-on-white layouts, because thin strokes anti-alias into gray. Default to 400+ for body text on light backgrounds and 500+ on dark backgrounds.

Line length and line height

Max measure 65-75 characters (max-width: 70ch is one line of CSS). Line-height 1.5 for body text. Both are single declarations that more than double reading comfort for dyslexic users.

Never justify text

text-align: justify creates rivers of white space that break reading flow for dyslexic and low-vision readers. Left-aligned is accessible-aligned.

Distinguishing fonts matters too

Ambiguity is accessibility: the classic il1 and O0 confusion is a typeface design trait. Fonts with distinguished glyphs (larger x-height, open apertures, monospaced variants for data) reduce misreads. And when an audit asks you to verify which font a legacy page actually renders, screenshot it and run an on-device identifier - Typeye names the typeface from a screenshot locally, no upload of production pages to third-party services.

The audit snapshot

  • Body text ≥16px, rem-based sizing
  • Weight ≥400 (light) / ≥500 (dark mode)
  • max-width: 70ch, line-height: 1.5
  • No justified text
  • A typeface with unambiguous glyphs

Six lines of CSS and one habit. Ship it.

Top comments (0)