/fitter-happier-text

Performant, fully fluid headings

Primary LanguageJavaScript

Fitter Happier Text

Performant, fully fluid headings


Usage

Include dist/fitter-happier-text.js in your project or install from NPM:

npm install fitter-happier-text

(or download it https://github.com/jxnblk/fitter-happier-text/archive/0.0.1.zip)

Pass it a nodelist.

var nodes = document.querySelectorAll('[data-fitter-happier-text]');
fitterHappierText(nodes);

Fitter Happier Text replaces each node with an SVG text node and sets the viewBox attribute based on its width and height.

To adjust for different fonts, use the baseline and paddingY options.

fitterHappierText(nodes, { baseline: 14, paddingY: 2 });

MIT License