WordPress / wporg-parent-2021

21 stars 11 forks source link

Add text-wrap rules for handling widows and orphans #118

Closed adamwoodnz closed 11 months ago

adamwoodnz commented 12 months ago

There are new CSS rules becoming available in browsers to handle widows and orphans, see https://developer.chrome.com/blog/css-text-wrap-pretty/

The feature does a little more than just ensure paragraphs don't end with a single word, it also adjusts hyphenation if consecutive hyphenated lines appear at the end of a paragraph or adjusts previous lines to make room. It will also appropriately adjust for text justification. text-wrap: pretty is for generally better line wrapping and text breaking, currently focused on orphans. In the future, text-wrap: pretty may offer more improvements.

There's also text-wrap: balance, which doesn't prevent orphans, but does ensure the text wraps in a way that creates a harmonious text block. I personally use balance for headlines and pretty for paragraphs.