Set the width and height of the SVG as the size of its container and set preserveAspectRatio = none.
<div height="50" width="100"> <svg preserveAspectRatio="none" viewBox="0 0 300 200"></svg> </div>
and
$("svg").each(function(){ this.width = this.parentNode.width; this.height = this.parentNode.height; }
What is it. CSS customization is not required.
I personally set the viewBox as the size of the SVG content. So, in my example, the original image that I upload to my SVG is 300x200. It will compress to 50x100. But viewBox manipulation is a separate issue.
john ktejik Nov 08 '14 at 4:37 a.m. 2014-11-08 04:37
source share