If you want to scale SVG without preserveAspectRatio
attribute.
This way SVG will always stretch to fill both width
and height
, and to do so, it will resize just width
or height
, if necessary, was looking for this for days, so thought to share it here in case someone else is looking for this
You have to remove width
and height
from <svg>
and add viewBox
attribute and add preserveAspectRatio="none"
example
<?xml version="1.0" encoding="utf-8"?>
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 5.8208332 15.9"
preserveAspectRatio="none">
<polygon points="480.4,200 0,200 0,0 480.4,0 599.9,100 " fill="#E1E1E1"/>
</svg>