Cross browser SVG preserveAspectRatio

后端 未结 5 880
渐次进展
渐次进展 2021-02-01 18:40

I\'m trying to have a SVG graphic inside an tag that would fit (without crop) inside the tag with preserved aspect ratio. I created t

5条回答
  •  时光说笑
    2021-02-01 18:50

    Seems like I found the solution:

    You need to keep the width and height properties in the SVG.

    ...
    

    And to make it work on IE 9 you need to specify at least one dimension of the tag.

    
    

    This seems to be working everywhere.

提交回复
热议问题