get-text-fit-size

1.0.3 • Public • Published

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.

License

WTFPL

Readme

Keywords

Package Sidebar

Install

npm i get-text-fit-size

Weekly Downloads

3

Version

1.0.3

License

WTFPL

Last publish

Collaborators

  • tehshrike