Balanced Text with Pretext.js

Balance text across lines with pretext.js — distribute words evenly like professional typesetting without DOM layout passes. A JavaScript alternative to CSS text-wrap: balance with full control. Pretextjs demo.

This page is part of Learn Pretext — interactive tutorials and live demos for pretext.js, the zero-dependency JavaScript text measurement library by Cheng Lou. New to the library? Start with the pretext.js tutorial, read why pretext exists, or browse the API reference. Enable JavaScript to run the live interactive demo and view its annotated source code.