鉴于此 svg:
<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<g>
<title>Layer 1</title>
<ellipse stroke="#000000" ry="210.999999" rx="259.000004" id="svg_1" cy="237.727263" cx="324.999989" stroke-width="5" fill="#FF0000"/>
</g>
</svg>
如何将其缩放到用户 320x240 而无需重新计算其中的数字?这可能吗?
最佳答案
添加viewBox="0 0 640 480"
并设置 width="320" height="240"
到 <svg>
缩放 SVG 的元素。你可以在width
上发疯和 height
并使用 preserveApsectRatio
控制纵横比属性。
https://stackoverflow.com/questions/14851646/