See the Pen Fitted Text with fitty by Chris Coyier ( on CodePen. fittyįitty is more like FitText in that it resizes type to maximize just horizontally, but actually seems to require no magic numbers. See the Pen Fitted Text with textFit by Chris Coyier ( on CodePen. So you need a width and height on the element for it to do it’s thing. Big caveat here though: textFit is designed for two-dimensions. Swap the words in FitText around and you got yourself textFit! It’s another JavaScript library that adjusts font sizes to fit text into a container. See the Pen Fitted Text with FitText (no jQuery) by Chris Coyier ( on CodePen.
See the Pen Fitted Text with Viewport Units by Chris Coyier ( on CodePen. In this case, font-size: 25.5vw works down to a 320px viewport, but still will break much lower than that. If you set type with vw (viewport width) units, you can find an exact number where the text pretty closely fits the container and doesn’t break as you resize. There are different technologies we can use and different considerations to think about. There are a number of ways to go about putting some text in a container and having it size itself to fill that container.