A very basic and lightweight vanilla fit-text web component.
Adjusts the font-size to fit the parent container width.
- vanilla web component / custom element
- less than 600 byte (minified + gzip)
- no dependencies
- no additional css / js required
- supports custom fonts
The implementation relies on custom elements and shadow dom parts of the web component specs
For using custom fonts, the browser must support the
FontFaceSet API (
Thus, not every major Browser is supported yet.
Play with this demo on codepen.io.
This fits to 50vw
Also checkout the examples directory.