I remember when I was learning CSS back in 2012, the guides said to never center-justify text as browsers did a terrible job. Since then, CSS has become way nicer, and yet justified text still looks awful. Great (or even good) typography always feels impossible on the web. But this demo blew me away! Fantastic!
lyallcooper/justif
Justif
Text justification for perfectionists
439stars
lyallcooper/justif
Justif
A drop-in JavaScript library that provides TeX-level text justification and microtypography for the web.
Visit project- First shared
- Jul 17, 2026
- HN activity
- 19840
Show HN@lyallJul 17, 2026
Show HN: Justif – Knuth-Plass justification and microtypography for the web
Justif is a drop-in JavaScript library that progressively enhances web pages to TeX-level text justification. Installation is a single script line, standard text and accessibility affordances are unchanged, and users with JS disabled get native browser rendering. I made justif because I've long been a fan of justified text. I think it looks clean and elegant, and makes reading more enjoyable. But bad justification is the opposite, with gaping spaces that distract me to the point of making the text near unreadable. Browsers have got better recently at handling justified text [0][1], but still use suboptimal greedy algorithms for the most part, and are not near that TeX/InDesign level of quality that I crave. `text-wrap: pretty` exists but is far from a panacea, as you can see for yourself in the demo. Justif also has the benefit of providing more consistent text layout across browsers. Blink (Chrome), Gecko (Firefox) and WebKit (Safari) all justify text differently, so normally what the user sees depends on what browser they use. Take a look at the demo, play around with it, see if you can break anything. I'm open to improvements of the API design as well, so please let me know your thoughts. For more details, see the README: https://github.com/lyallcooper/justif 0: https://cloudfour.com/thinks/justified-text-better-than-expe... 1: https://owickstrom.github.io/the-proportional-web/
Community