3 min read
Text Wrap
Your hero title ends with one word on its own line. You tried a smaller font. The orphan stayed. The browser broke the line that way on purpose.
The Principle
Text wrapping is how content flows at line endings. Browsers use a greedy algorithm: fill each line, then move on. That often strands one word on the last line of a heading. text-wrap overrides that behavior.
The Rule I Follow
I set text-wrap: balance on headings and text-wrap: pretty on body text. Both only intervene when the layout would look obviously awkward.
Try It Yourself
Flip balance on the heading and pretty on the paragraph. Watch the last lines change.
Typography rules for modern web design
Good typography isn't just about what fits on one line. It's about what happens when it doesn't. The way text wraps can change how comfortable it is to read. Matters.
With both on, the heading lines even out and the paragraph loses its orphan.
The Mistake I'd Avoid
Forcing manual line breaks to make one screen look perfect. They'll almost always fall apart on another device.
Remember This
Design for how text wraps, not how it looks on your screen.
h1, h2, h3, h4 {
text-wrap: balance; /* even line lengths on short headings */
}
p {
text-wrap: pretty; /* avoid orphaned last words */
}h1, h2, h3, h4 {
text-wrap: balance; /* even line lengths on short headings */
}
p {
text-wrap: pretty; /* avoid orphaned last words */
}