SVG transform=“rotate(180)” does not work in Safari 11

前端 未结 2 609
小鲜肉
小鲜肉 2020-12-01 21:06

For some reason element

...

is shown as not rotated in Safa

相关标签:
2条回答
  • 2020-12-01 21:48

    In SVG 1.1 <svg> elements did not support transform attributes. In SVG 2 it is proposed that they should.

    Chrome and Firefox implement this part of the SVG 2 specification, Safari does not yet do so and IE11 never will.

    You can achieve the same result in browsers that do not support this SVG 2 feature either by replacing the <svg> element by a <g> element or by creating an <g> child element on the <svg> element and putting the transform on the <g> element.

    0 讨论(0)
  • 2020-12-01 22:01

    Browsers allow you to use CSS on the SVG-elements, so an easy fix is to use the CSS transform instead.

    <!-- ( works on all elements ) -->
    <path style="transform:rotate(180deg)" />
    
    0 讨论(0)
提交回复
热议问题