Reputation: 696
I'm trying to create a layout like this in my Next.js project:
There will be a word, an image in between, and then another word, like above. I need to dynamically set the font size in order to take all available space. How can I do this?
Upvotes: 3
Views: 3444
Reputation: 97
There is an article that show lots of methods to do that.
https://css-tricks.com/fitting-text-to-a-container/
Libraries you can take a look:
Upvotes: 1
Reputation: 1121
textFit It’s JavaScript library that adjusts font sizes to fit text into a container.
fitty is another JS library resizes type to maximize just horizontally
You can find more options here and go with the one suits you best. Link
Upvotes: 4