get-text-fit-size
v1.0.3
Published
Find out what font size will make a text block fit inside of another element without wrapping
Downloads
3
Readme
get-text-fit-size
Given a target element and some text, figures out what font size you should use so that the text will exactly fit the width of the container.
getTextFitSize(containerElement, text)
The width and font styles of the container element will be used for the calculations.
There may be some weirdnesses with bold fonts on Safari. Open an issue or PR if you know anything.
Works in all modern browsers except IE or Edge.