Back to browse
Justif – publication-grade text justification for the web

Justif – publication-grade text justification for the web

by lyall·Jul 17, 2026·2 points·0 comments

AI Analysis

●●SolidNiche GemCozy

Brings TeX-quality Knuth-Plass justification to the web where CSS text-align fails.

Strengths
  • Implements Knuth-Plass line breaking algorithm previously unavailable in standard JS libraries.
  • Side-by-side comparison mode instantly visualizes the gap reduction against native rendering.
  • Single script import with no build step required for immediate integration.
Weaknesses
  • Layout shifts may occur as JS recalculates lines after initial DOM paint.
  • Niche appeal limits adoption to specific publishing use cases rather than general web dev.
Category
Target Audience

Frontend developers, typography enthusiasts, digital publishers

Similar To

hyphenopoly.js · typeset.css

Post Description

I've long been a fan of justified text. I think it looks clean and elegant. But I've always been disappointed by how browsers render it, 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], but still are not near that TeX/InDesign level of quality that I crave.

Inspired by running headfirst into disappointment with how text justification looked on a recent project site of mine, and by Oskar Wickström's "Proportional Web" [1], I decided to make a drop in js library that justifies text at least as well as TeX can, all with a single <script> import.

Justif also has the benefit of providing 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, try some different browsers. Constructive feedback is always welcome.

0: https://cloudfour.com/thinks/justified-text-better-than-expe... 1: https://owickstrom.github.io/the-proportional-web/

Similar Projects