Inline SVG breaks in Safari and Mobile Safari

后端 未结 1 926
予麋鹿
予麋鹿 2021-01-05 11:11

I recently launched a site which used a bit of inline SVG.



        
1条回答
  •  悲哀的现实
    2021-01-05 11:31

    It turns out that Safari and Mobile Safari freak out if you omit the height and width attributes I was setting the dimensions with CSS, which worked fine in other browsers. But I had to add those attributes back in to make it behave consistently:

    
         
    
    

    Notice the width and height attributes that were missing above.

    Also, it's interesting to point out that the value of preserveAspectRatio matters. I had a couple other inline SVG elements that had preserveAspectRatio="none meet" and they were unaffected by this issue.

    0 讨论(0)
提交回复
热议问题