← Back to release summary

CSS text-wrap: pretty

Category
CSS
Type
Chromium catches up
Status
Enabled by default (Chrome 117)
Intent stage
Start prototyping

Summary

Adjusts line breaking to avoid a short single word on the last line (also known as typographic orphans.) When `text-wrap: pretty` is specified, paragraphs that will end up with a short single word on the last line are adjusted so that the last line has two or more words. It also adjusts hyphenation if consecutive hyphenated lines appear at the end of a paragraph. The algorithm is based on the Knuth-Plass algorithm, as used by TeX. It computes scores for all candidates, and chooses the best one. To balance between the typographic benefits and the performance impacts, it adjsuts the last 4 lines of paragraphs that meet certain conditions.

Standards & signals

Docs: https://docs.google.com/document/d/1jJFD8nAUuiUX6ArFZQqQo8yTsvg8IuAq7oFrNQxPeqI/edit?usp=sharing

Samples: https://output.jsbin.com/hopejeb

View on chromestatus.com