鍍金池/ 問答/HTML/ 為什么我用SVG畫的圓弧在安卓上正常,在IOS上起點是從右邊3點的位置開始的?

為什么我用SVG畫的圓弧在安卓上正常,在IOS上起點是從右邊3點的位置開始的?

clipboard.png
在安卓上是這樣的,瀏覽器模擬IOS的時候也是正常的,但是在手機上看就出問題了,有前輩遇到過這樣的問題嗎

clipboard.png

回答
編輯回答
嘟尛嘴

SVG外層元素的樣式上,逆時針旋轉90度就好了。
注意:在IOS 10.x Safari中,90deg不生效,加任意小數(shù)點即可。

<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta charset="UTF-8">
  <style>
    #circle {
      transform: rotate(-90.1deg); /* IOS 10.x Fix */
      -webkit-transform: rotate(-90.1deg);
      display: inline-block;
    }
  </style>
</head>
<body>
  <span id="circle">
    <svg width="100" height="100" viewBox="0 0 100 100">
      <circle fill="none" stroke="#eaeaea" stroke-width="8" cx="50" cy="50" r="46"></circle>
      <circle fill="none" stroke="red" stroke-width="8" stroke-miterlimit="1" stroke-dasharray="290, 290" stroke-linecap="round" cx="50" cy="50" r="46">
        <animate attributeName="stroke-dashoffset" begin="0s" dur="10s" from="290" to="0" repeatCount="1"></animate>
      </circle>
    </svg>
  </span>
</body>
</html>
2017年7月31日 10:26