Balance your headlines with one line of CSS.
With text-wrap: balance the browser spreads a headline's words across even lines and leaves no lone word hanging. It is two CSS rules and it does not change the design.
A big headline breaks wherever it happens to: the last line ends up with one stray word and the block looks crooked. It is one of those details you notice without saying why, and AI-built sites leave it as is because nobody asked.
The fix is one line of CSS, supported in browsers since 2024. The hard part is knowing where to use it and where not to.
What each value does
According to MDN, text-wrap has been available across browsers since March 2024. Its balance and pretty values do different things:
balancespreads characters evenly across lines. It suits headings, captions and quotes.prettyuses a slower algorithm that mainly avoids last lines with a single word. MDN describes it as meant for body copy.wrapis the default: it breaks where it must and nothing more.
The limit nobody mentions
Counting characters and spreading them costs computation, so MDN warns that balance only works on blocks of a few lines: six or fewer in Chromium and ten or fewer in Firefox. A long paragraph with balance is not balanced, it just stays as it was.
That is why the rule goes on headings and not on body. For long paragraphs, pretty.
The CSS to copy
Put this once in your global stylesheet:
h1, h2, h3, blockquote, figcaption {
text-wrap: balance;
}
p, li {
text-wrap: pretty;
}If you use Tailwind, the classes are text-balance and text-pretty. One useful detail: the headline in the tip on text size asks for few words and a big size, and that is exactly where a lopsided three-line headline shows most.
How to check it
Open your page and shrink the window to phone width. Look at the last line of each headline: if it holds one word or two letters, the rule is missing. With the rule on, lines should come out about the same length.
This is form, not content: an even headline over an empty sentence is still slop. To see the rest of your page's signals, run your site through the Slop Score.
Ask your AI tool like this
A prompt that fits in any tool's chat:
In the global CSS add text-wrap: balance to h1, h2, h3, blockquote and figcaption, and text-wrap: pretty to p and li. Do not change sizes, spacing or colors. Check that no headline ends with a single word on the last line at 375 px wide.Sources
- text-wrap, MDN, November 15, 2026
- text-wrap-style, MDN, November 15, 2026
Frequently asked questions
What does text-wrap: balance do?
It spreads the text of a block over lines of similar length. MDN says it only applies to blocks of a few lines: six or fewer in Chromium and ten or fewer in Firefox.
What is the difference between text-wrap balance and pretty?
Balance evens out the lines of short text, like a headline. Pretty uses a slower algorithm to avoid last lines with a single word, and is meant for body text.