How do I scale a stubborn SVG embedded with the tag?

You can add “preserveAspectRatio” and “viewBox” attributes to the <svg> tag to accomplish this.

Open the .svg file in an editor and find the <svg> tag.
in that tag, add the following attributes:

preserveAspectRatio="xMinYMin meet"
viewBox="0 0 {width} {height}"

Replace {width} and {height} with some defaults for the viewBox. I used the values from the “width” and “height” attributes of the SVG tag and it seemed to work.

Save the SVG and it should now scale as expected.

I found this information here:

https://blueprints.launchpad.net/inkscape/+spec/allow-browser-resizing

Leave a Comment