0

Problem: I want to set a div container to a max-width of 500px, but if the font-size: 5vw; inside of the div is set to 5vw, the text keeps getting bigger even after the div reaches its max size.

So basically I want to make text inside an image scale with the size of that image, but stop growing when the div texts' container stops growing.

Main Question: Is there a way for me to have font-size: 5vw scale with the size of its container div, and not the whole viewport?

manski
  • 131
  • 1
  • 10
  • 3
    `vw` is the viewport width, not any container's width. so, use `%` instead – technophyle Dec 29 '22 at 20:15
  • Thanks. I have tried to use %, but I would like the text to re-size in real time as the viewport changes. With %, I the text size stays the same once it is rendered. I have considered using @media query, but I feel like there has to be a simpler solution than that. – manski Dec 29 '22 at 20:24
  • this may answer your question? https://stackoverflow.com/questions/16056591/font-scaling-based-on-size-of-container – Jake Dec 29 '22 at 20:27

0 Answers0