Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This solves a real problem for me. In the past I've used <wbr> with white-space:nowrap set on the parent to help choose logical breaks in text, but it's tedious and requires DOM access.

A simple CSS rule to automatically calculate this is very welcome.

I'm not sure I like the name "pretty" for the second rule though. If they have to expose the algorithm (first-fit vs Knuth-Plass), I'd rather they choose more descriptive names.



You can also use &nbsp; between the penultimate and the ultimate word, that doesn’t require additional styling.


But that alters the content, and copy/paste would carry that forced pairing into a different line-length context.


In macOS, you can achieve this in plain text with [option]-[space]. Helpful in Markdown — although, of course, you can use `&nbsp;` in Markdown, as well.


This is my preferred method (now!). Also very simple to write a couple of lines of JavaScript to target P and H elements and replaces the last space with a non breaking space.

But a CSS method is very welcome!


Please do this at build time instead of shipping to clients. You'll slow down page rendering, introduce a repaint, and now require a script. Considering all browsers will be doing the exact same execution, it's needlessly wasteful.

Same thing applies to client-side syntax highlighting and LaTeX.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: