A fairly long heading that wraps onto multiple lines
Default wrapping can leave a lopsided last line.
If you searched text-wrap balance or how to stop orphan words in CSS, the text-wrap property balances heading lines and avoids single-word last lines in paragraphs, with no JavaScript.
Even line lengths look more intentional.
Default wrapping can leave a lopsided last line.
text-wrap: balance evens out the lines.
h1, h2, h3 {
text-wrap: balance;
}Avoid a single orphan word on the last line.
This paragraph uses text-wrap pretty so the last line is not a lonely orphan word left dangling all by itself.
pretty adjusts the final lines to prevent orphans.
p {
text-wrap: pretty;
}Other values for controlled layouts.
nowrap prevents wrapping; stable avoids reflow while typing.
.label { text-wrap: nowrap; }
.editor { text-wrap: stable; }