0

I have a div, width:400px;.

The div contains text, which greets a user, e.g Hello, John Smith. I want the text to be dynamically sized to always fit the maximum width of the div, regardless of the text.

So, if the user's name is Hubert Blaine Wolfeschlegelsteinhausenbergerdorff Sr., I want the text to be formatted to not overflow the 400px, with no line break (longer name = smaller text).

I can only find examples of how to do this when the name does not change (just changing the size... is it possible to do it the way I'd like?

Joseph
  • 691
  • 4
  • 18
  • Check out this question: https://stackoverflow.com/questions/16056591/font-scaling-based-on-width-of-container Maybe it helps you out! – jona Apr 21 '22 at 10:13
  • Quintessence of it: https://css-tricks.com/fitting-text-to-a-container/ – jona Apr 21 '22 at 10:14

0 Answers0