Justifying text-wrap: pretty
Hacker News
February 19, 2026
AI-Generated Deep Dive Summary
In a significant leap forward for web typography, Safari introduced a new feature in 2025 with its implementation of `text-wrap: pretty`, marking a step toward more elegant paragraph formatting. This development addresses the long-standing issue of poor line breaking in browsers, which previously relied on a naive greedy algorithm that often resulted in uneven text alignment. While this improvement brings us closer to the precision achieved by traditional printing methods, it introduces an unexpected challenge when combined with `text-align: justify`, causing distorted spacing and misaligned paragraphs.
Historically, typography has evolved from manual processes like Gutenberg's movable type to advanced algorithms used in TeX, which employ dynamic programming for optimal line breaks. However, web browsers face unique challenges due to dynamic window resizing and computational constraints. Safari's new feature uses a scoring system to balance line lengths but struggles when justified text forces lines to stretch beyond the intended width, leading to inconsistent spacing.
The crux of the issue lies in how `text-wrap: pretty` interacts with `text-align: justify`. While each works individually without problems, their combination creates an imbalance
Verticals
techstartups
Originally published on Hacker News on 2/19/2026