You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your text should now fluidly resize, by default: Font-size = 1/10th of the element's width.
The Compressor
If your text is resizing poorly, you'll want to turn tweak up/down "The Compressor". It works a little like a guitar amp. The default is 1.
jQuery("#responsive_headline").fitText(1.2);// Turn the compressor up (resizes more aggressively)jQuery("#responsive_headline").fitText(0.8);// Turn the compressor down (resizes less aggressively)
This will hopefully give you a level of "control" that might not be pixel perfect, but resizes smoothly & nicely.
minFontSize & maxFontSize
FitText now allows you to specify two optional pixel values: minFontSize and maxFontSize. Great for situations when you want to preserve hierarchy.
⚠️ Run FitText before anything that hides the element you're trying to size (e.g. before Carousels, Scrollers, Accordions, Tabs, etc). Hiding an element's container removes its width. It can't resize without a width.
⚠️Make sure your container has a width!
display: inline elements don't have a width. Use display: block OR display: inline-block+ a specified width (i.e. width: 100%).
position:absolute elements need a specified width as well.
Tweak until you like it.
Set a No-JS fallback font-size in your CSS.
🆕 If your text is full width, you might want to NOT use FitText and just use CSS vw units instead. Supported in all major browsers.
Don't use jQuery?
That's okay. Check out these handy non-jQuery versions maintained by other people.