Typography in CSS controls how text occupies space. Line height, font size, measure, and wrapping affect reading more than a decorative font choice alone.
CSS readable type: set measure and rhythm before decorative details
How the rule works
An investigation report contains long paragraphs and case IDs. The paragraph column uses a moderate maximum line length and generous line height. IDs may need controlled wrapping, but ordinary prose should keep natural word breaks. Avoid fixed-height cards: larger text, localization, and browser zoom will extend the content. A bold title is not a substitute for the correct HTML heading. Test with actual paragraph copy and a screen reader's reading order separately; CSS can make text easier to see but cannot repair a missing semantic structure.
.investigation-report { max-inline-size: 70ch; font-size: 1rem; line-height: 1.6; }
.investigation-report p { margin-block: 0 1rem; }
.investigation-report .case-id { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }Cost and verification
The rules add no network request unless a custom font is also loaded. Tabular numerals can make columns of numbers easier to scan only when the font supports them. Check the report at 200% zoom and with user font overrides. A 70ch cap is approximate and may need adjustment for the chosen font and script; do not equate it to exactly seventy visible characters.
Common Mistakes
- Do not rely on CSS font size to create a document heading.
- Do not force prose into fixed-height boxes.
- Do not break every word merely to prevent one long identifier from overflowing.
Connected lessons
- CSS Type and Media
- CSS font loading: keep content readable while a font arrives
- CSS clamp for type: grow headings within readable bounds
- HTML headings and paragraphs: expose a readable outline without styling tricks
Extend this decision
- CSS text wrapping and truncation: keep records readable
- CSS list markers and counters: change appearance without changing order
Property decisions
Further form and type decisions
Further rendering decisions
- CSS font-variant-ligatures: keep identifiers visually literal
- CSS text-transform: change display case without corrupting source data
