Earlier quoted context omitted.
This had me wondering about whether it was possible to use pre-calculated line breaks to implement improved text justification in current browsers. I was able to come up with a demo [1][2] that does so, although it falls back to default line breaks in Safari due to lack of support for `text-align-last`. [1] https://mpetroff.net/files/pre-calculated-line-breaks-demo/ [2] https://mpetroff.net/2020/05/pre-calculated-lin…
Ho-hum :) I'm slightly torn between admiration and horror: > The key is to wrap all the potential line breaks (inserted via ::after pseudo-elements) and hyphens in elements that are hidden by default with display: none;. Media queries are then used to selectively show the line breaks specific to a given column width. Doesn't look like you compared with simply inserting soft hyphens - last I looked, that made columns…
While browser hyphenation (either auto or soft hyphens) is definitely an improvement over no hyphens for narrower column widths, I think it generally makes things worse for wider columns, since it frequently adds unnecessary hyphens.
Edit: I updated the demo to use soft hyphens for the browser default comparison so the text is hyphenated in all browsers.