Balance heading text
3 min read, 3 skills
A two-line heading with one word on the second line looks like a mistake. Designers used to fix it by hand with <br> tags or non-breaking spaces, which broke as soon as the viewport or the copy changed.
text-wrap: balance asks the browser to split the text into lines of roughly equal length. It only works on short blocks (a few lines), which is exactly what headings, card titles, and captions are. In Tailwind it is the text-balance utility.
cssh1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
For body copy use text-wrap: pretty instead. It is cheaper and only avoids a lone word on the last line. Neither property changes the font size, so set a sensible max-width in ch units as well.
Skills in this chapter
Better Typographyby jakubkrehel
Web typography from choosing fonts to spacing, wrapping and accessibility. Use when picking or pairing typefaces, configuring variable fonts or OpenType features, setting up a type scale, styling text in components, truncating text, styling underlines, selection, placeholders or carets, or reviewing frontend code for typography. Triggers on typography, fonts, font formats, woff2, variable fonts, font-weight, opentype, font-feature-settings, letter-spacing, line-height, type scale, tabular numbers, text-wrap, truncation, line clamp, underlines, text-decoration, text selection, iOS input zoom, font smoothing, text contrast, measure, line length, text-box, smart punctuation, drop cap.
TypographyExternalGitHub stars: 9.2K
Swiss Designby zeke
Swiss design system skill focused on grid discipline, typography hierarchy, and clean editorial interface composition.
VisualExternalGitHub stars: 159
Spacing That Doesn't Look AI-Generatedby UI Skillbook
Use a consistent spacing scale and grouping logic instead of arbitrary padding values.
Layout