Scale SVG to container without mask/crop

后端 未结 3 1613
天命终不由人
天命终不由人 2020-12-04 09:46

I have tried many variants of the svg parameters, but have had no joy in scaling this particular SVG.

I am trying to contain this SVG into a container e

3条回答
  •  眼角桃花
    2020-12-04 10:15

    Unfortunately, I don't know the answer that applies to raw SVG, but in Raphael.js, I did it like that:

    var paper = Raphael('#container', your_container_width, your_container_height);
    paper.setViewBox(realSvgWidth, realSvgHeight, true);
    

    This technique scaled my SVG to fit the bounds.

    Hope this helps.

提交回复
热议问题