25% off ProSNIPC25OFF

Prevent Widows in Headings

Uses CSS text-wrap: balance on headings and text-wrap: pretty on body copy to prevent orphaned single words on the last line.

CSSby SnipCraft
css
/* Prevent typographic widows using text-wrap.
   Supported in Chrome 114+, Firefox 121+, Safari 17.4+.
   Falls back gracefully (no visible effect) in older browsers. */

/* Balance heading text across lines — prevents one-word last lines */
h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}

/* 'pretty' avoids a lonely last word in paragraphs */
p {
    text-wrap: pretty;
}

/* Also useful for short labels and captions */
figcaption,
blockquote,
.entry-title,
.widget-title {
    text-wrap: balance;
}
#accessibility#css#headings#typography