Ragged headlines come from greedy line filling: the engine packs words left-to-right and lets the last line dangle. text-wrap: balance lets it trade some fill evenness for equal line lengths; text-wrap: pretty keeps one-word last lines off paragraphs. Each is a single declaration.
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }Which value, where
- Headlines, buttons, kickers: balance. Keep it under a few lines; balance cost grows with length.
- Body paragraphs: pretty. Its one job is the orphan word at the end, and it does that job quietly.
- Never balance a paragraph: evening the lines without re-weighing the sense reads worse, not better.
Both are supported across all modern engines today; browsers older than the feature simply wrap as before. Set it once site-wide, read every page on the narrowest viewport you support, and keep the two lines. Costs nothing, reads better: gacor typography budget.
