Why Isn’t My SVG Image the Right Size in Internet Explorer
By Forrest Smith - Drempd.com
My svg images looked fine in the good browsers, but in Internet Explorer, they were appearing huge! I attempted to just set the size using css in the image tag, but that didn’t work.
What actually did work, was I opened up the svg file, and added a “viewBox” value to the svg declaration, so I my file looked something like this:
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="400" height="360" viewBox="0 0 400 360" ....
So the viewbox numbers, I just set this to start at the top left (the two 0’s), and then set the other corner of the viewbox with the 400 (the width), and the 360 (the height). This change fixed it.
-
Adventure
-
The Built Environment
-
Locations
-
Web Dev