0

So I make my font size in vw and I read that if I make my img size in rem they will be dependent on the font size but no its not like that the text go smaller but pictures stay the same :/ Im new to html/css sorry for the question

  • 2
    Questions seeking debugging help ("**why isn't this code working?**") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it **in the question itself**. Questions without a **clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – joka00 Mar 20 '19 at 21:54
  • I'm not sure what you mean, but adding a size of an element like an image, or a text in em or vw or px won't automatically make it react to text size as far as i know. You will most likely need some JS for this to work, which "checks" the font size, and accordingly sets the size of an image. Tell me if i didn't understand your question correctly. And please also add an example of whatever you did, as Josef mentioned. – Frizzant Mar 20 '19 at 22:05
  • I think you are looking for this? [https://stackoverflow.com/a/18435866/7262739](https://stackoverflow.com/a/18435866/7262739) – Frizzant Mar 20 '19 at 22:07

1 Answers1

0

It seems that your problem is that you're using rem and not em. rem refers to root em, meaning the font size of the root element. em simply refers to the font size of the parent element. If you're trying to change an image's size depending on the font size, I would recommend using em over rem.