Story Details

  • Better typography with text-wrap pretty

    Posted: 2025-04-08 15:10:29

    WebKit now supports the text-wrap: pretty CSS property, improving typography for justified text. This property optimizes word spacing and hyphenation to produce more visually appealing and readable justified text, addressing issues like excessive whitespace or too many hyphenated lines. text-wrap: pretty aims to prioritize aesthetics and comprehension by intelligently balancing these typographic elements, leading to a more refined and professional look for justified text on the web. It provides a simple way for developers to enhance the appearance of justified text blocks without resorting to complex manual adjustments or JavaScript workarounds.

    Summary of Comments ( 137 )
    https://news.ycombinator.com/item?id=43622703

    Hacker News users generally praised the new text-wrap: pretty CSS property for addressing a long-standing typography issue with justified text. Several commenters pointed out the benefits for accessibility, particularly for users with dyslexia or other cognitive differences, as the more consistent spacing makes text easier to parse. Some expressed concern about potential performance implications, especially with large blocks of text, but others downplayed these concerns given modern browser optimizations. A few users wished for further refinements, like hyphenation control or integration with existing text justification methods, but overall the sentiment was positive, viewing the feature as a significant improvement for web typography. The discussion also touched upon the subtle differences between text-wrap: pretty and text-justify: distribute, with some clarifying the distinct functionalities and advantages of each.