Sometimes, we want to make SVG images scale using the CSS “width” property.
In this article, we’ll look at how to make SVG images scale using the CSS “width” property.
How to make SVG images scale using the CSS “width” property?
To make SVG images scale using the CSS “width” property, we remove the width attribute from the svg.
For instance, we write
<svg viewBox="0 0 12 20">...</svg>
to add an svg without the width attribute to make SVG images scale using the CSS width property outside the svg element.
Conclusion
To make SVG images scale using the CSS “width” property, we remove the width attribute from the svg.