Cross browser SVG preserveAspectRatio

后端 未结 5 854
渐次进展
渐次进展 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 19:09

    The solution in my case was using Peter Hudec's answer, but because of using width: 100%; on the tag, which broke the layout on every non-IE9 browser, I added a IE9-only CSS hack (width: 100%\9\0;). Hope this addition will help someone. :-)

    Even using the preserveAspectRatio="xMidYMid meet" was not neccessary.

    (I wanted to add only a comment, and not answer, but no reputations yet to do so :-)

提交回复
热议问题