Why don’t SVG images scale using the CSS “width” property?

SVGs are different than bitmap images such as PNG etc. If an SVG has a viewBox – as yours appear to – then it will be scaled to fit it’s defined viewport. It won’t directly scale like a PNG would.

So increasing the width of the img won’t make the icons any taller if the height is restricted. You’ll just end up with the img horizontally centred in a wider box.

I believe your problem is that your SVGs have a fixed height defined in them. Open up the SVG files and make sure they either:

  1. have no width and height defined, or
  2. have width and height both set to "100%".

That should solve your problem. If it doesn’t, post one of your SVGs into your question so we can see how it is defined.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)