How do I resize some text based on the length of the text and the size of the container?
It's for a title. I basically want to say: "If the dynamically generated <h2>
has less than 10 characters, increase the font size to 2em
to fill the space. Otherwise, leave it at 1em
".
Ideally I'd quite like to just resize the text up to a maximum. As in, "the title isn't fully fitting the horizontal space, so increase font size without going onto a second line". Is that doable?
I can't send you a link, since the site isn't live.