Somebody on the team typed between the last two words of a headline to stop the orphan. It worked at that viewport. Then the copy changed, and now there is a strange gap in the middle of a line on mobile.
The card grid has the same problem in bulk: nine titles, nine different break points, and the whole grid reads as untidy for a reason nobody can name in review. Both are line-breaking problems. Both have had a CSS answer for years, and most Laravel front ends still are not using it.
Map the two utilities to the CSS they emit#
Tailwind ships four text-wrap utilities as core, no plugin needed. Two of them matter here, and they are not stronger and weaker versions of the same thing — they solve different problems.
/* text-wrap */ text-wrap: wrap;
/* text-nowrap */ text-wrap: nowrap;
/* text-balance */ text-wrap: balance;
/* text-pretty */ text-wrap: pretty;
balance asks the browser to redistribute words so every line is roughly the same length. It is a whole-block decision, which is why it is expensive and why it is capped.
pretty leaves line breaking alone and then fixes the end of the block — no single word stranded on the last line, no painfully short final line. Safari's implementation goes further and improves the ragged edge and hyphenation across the block.
Apply text-balance to headings and card titles#
Put text-balance on anything measured in a handful of lines: h1–h3, card titles, blockquotes, buttons, table headers. The card grid is the clearest win, because the inconsistency between siblings is what reads as sloppy.
<div class="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
@foreach ($articles as $article)
<article class="rounded-xl border p-5">
{{-- Without text-balance, nine titles break at nine different points --}}
<h3 class="text-balance text-lg font-semibold">
{{ $article->title }}
</h3>
<p class="mt-2 text-sm text-gray-600">{{ $article->excerpt }}</p>
</article>
@endforeach
</div>
One caveat worth knowing before you ship it: balancing needs a measure to balance against. If the heading sits in a flex item with no width constraint, give it a max-w-* — see the gotchas below.
Apply text-pretty to body copy#
Paragraphs get text-pretty. It is cheap enough to set once on a container and let it inherit, which is the sane way to handle a long article body or a CMS-rendered block.
<article class="text-pretty">
<h1 class="text-balance text-3xl font-bold">{{ $post->title }}</h1>
{{-- Every paragraph inside inherits text-pretty --}}
{!! $post->html !!}
</article>
Note the nesting: text-pretty on the container, text-balance overriding it on the heading. That is the normal shape of this, and it is exactly the arrangement Tailwind's own docs demonstrate.
Respect the six-line cap#
This is the part nobody mentions. Browsers limit text balancing to blocks of roughly six lines or fewer, for performance — balancing cost grows with every extra line. Past the cap the browser silently falls back to normal wrapping.
<!-- Does nothing. Costs layout time. Looks like it works because
normal wrapping is the fallback. -->
<p class="text-balance">
Four hundred words of body copy that will never be balanced...
</p>
<!-- What you actually wanted -->
<p class="text-pretty">
Four hundred words of body copy, minus the orphan on the last line.
</p>
If you want to see the cap, open devtools on a paragraph with text-balance, check that the computed text-wrap really is balance, then delete sentences until the block drops under six lines. The layout snaps the moment balancing kicks in.
Own the rule in a Blade component#
Scattering text-balance across forty templates means the next person adds a heading without it, and the review does not catch it. Put the decision in a component instead.
{{-- resources/views/components/heading.blade.php --}}
@props(['level' => 2, 'measure' => 'max-w-2xl'])
@php
$tag = 'h'.$level;
@endphp
<{{ $tag }} {{ $attributes->class([
'text-balance', // even line lengths
$measure, // balancing needs something to balance against
'text-3xl font-bold' => $level === 1,
'text-xl font-semibold' => $level >= 2,
]) }}>
{{ $slot }}
</{{ $tag }}>
Used as <x-heading :level="1">{{ $post->title }}</x-heading>, every heading on the site changes the day the rule changes. If you are already running a token-driven component layer, this belongs in the same place as your custom Tailwind utilities defined in CSS.
Define a prose utility for content blocks#
For content you do not control — Markdown output, a CMS field — a named utility beats repeating the class. The @utility directive registers it as a first-class Tailwind utility, so variants like md: still work on it.
/* resources/css/app.css */
@import "tailwindcss";
@utility prose-copy {
text-wrap: pretty;
max-inline-size: 65ch; /* a measure, so pretty has something to work with */
}
<div class="prose-copy">
{!! $article->html !!}
</div>
Keep it apart from wrap-anywhere and break-words#
These are a different family solving a different problem, and conflating them wastes an afternoon. text-wrap decides where the browser prefers to break between words. overflow-wrap and word-break decide whether a single unbreakable string may be broken at all.
A 180-character tracking URL blowing out a table is not a balancing problem, and no amount of text-balance will fix it — that is wrap-anywhere versus wrap-break-word, and the rules there are genuinely different.
One real conflict: truncate sets white-space: nowrap, which means there is only ever one line. Both text-balance and text-pretty become no-ops. Never put them on the same element.
Verify it across viewports#
Balancing is viewport-dependent by definition, so a single screenshot proves nothing. Check three widths — narrow phone, tablet, and whatever your widest content column is — and confirm the computed value in devtools rather than trusting the class list.
// Paste in the console: find blocks that asked for balance but are too tall to get it
document.querySelectorAll('.text-balance').forEach((el) => {
const lines = Math.round(el.clientHeight / parseFloat(getComputedStyle(el).lineHeight));
if (lines > 6) console.warn('Over the balance cap:', lines, 'lines', el);
});
For a card grid, screenshot-diff at those three widths in CI. A copy change six weeks from now is what quietly reintroduces the orphan, and if your cards already use subgrid to align their rows, a title that gains a line is visible across the whole row.
Gotchas and Edge Cases#
Browser support splits between the two. balance is everywhere that matters — Chrome 114+, Firefox 121+, Safari 17.5+. pretty is Chrome 117+ and Safari 26+, and Firefox has not shipped it as of late 2026. Both fall back to normal wrapping, so there is nothing to polyfill and nothing to feature-detect. There is also no guarantee, which is the next point.
Never depend on a specific break. The browser is allowed to ignore you. If a design only works when the heading is exactly two lines, that design needs a different fix — a shorter string, a max-w-*, or an explicit <br> behind a breakpoint variant.
Balance inside an unconstrained flex item does odd things. The algorithm balances against the available inline size; a flex item sized by its content gives it a moving target. Add a measure (max-w-prose, max-w-2xl) and the result stabilises.
Translated copy breaks differently. German compounds and Finnish case endings are longer than the English you tested. If the site is multilingual, review the longest locale — the orphan you fixed in English can reappear as a two-line overflow elsewhere.
Safari's pretty is not Chromium's pretty. WebKit improves the ragged edge and hyphenation across the whole block; Chromium focuses on the last lines. Same declaration, visibly different output. Fine for body copy, not something to design a tight layout around.
Wrapping Up#
Set text-pretty once on your content container, add text-balance to a <x-heading> component, and delete every and hard-coded <br> someone added to a headline. That is the whole job — about twenty minutes, and it will not regress because the rule lives in one place.
If you are tidying up heading treatment anyway, Tailwind's text-shadow utilities cover the other half of making headings look deliberate, and container queries are the right tool when a card title needs to respond to its container rather than the viewport.
FAQ#
What does text-balance do in Tailwind?
text-balance compiles to text-wrap: balance. It asks the browser to redistribute words across lines so each line is roughly the same length, instead of filling each line greedily and leaving whatever fits on the last one. It is a core Tailwind utility, available without any plugin, and it is meant for short blocks like headings and card titles.
What is the difference between text-balance and text-pretty?
text-balance changes where every line breaks in order to even out line lengths across the block. text-pretty leaves normal line breaking alone and only fixes the end of the block, preventing a single word stranded on the last line. Balance is for short blocks, pretty is for paragraphs, and they are not weaker and stronger versions of the same algorithm.
How do I stop a single word on the last line of a heading?
Add text-balance to the heading and remove any or hard-coded <br> that was previously used to force the break. If the heading sits in a flex item, also give it a width constraint such as max-w-2xl, because balancing needs a defined measure to work against. Put the class in a shared heading component so the fix applies everywhere.
Is text-wrap: balance bad for performance?
It costs more than normal wrapping, which is exactly why browsers cap it at roughly six lines and fall back silently beyond that. On headings and card titles the cost is negligible. The real waste is applying it to long body copy, where you pay for the attempt and get normal wrapping anyway.
Which browsers support text-wrap pretty?
text-wrap: pretty is supported in Chrome 117 and later and in Safari 26 and later. Firefox has not shipped it as of late 2026 and falls back to normal wrapping with no layout breakage. text-wrap: balance has far wider support — Chrome 114+, Firefox 121+ and Safari 17.5+.
Should I use text-balance on paragraphs?
No. Browsers stop balancing past roughly six lines, so on a normal paragraph the declaration does nothing visible while still asking the layout engine to try. Use text-pretty on paragraphs instead — it is designed for exactly that case and removes the orphan on the final line.