Latest web development tutorials

SVG 圓形

SVG 圓形- <circle>

<circle> 標籤可用來創建一個圓:

下面是SVG代碼:

實例

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="100" cy="50" r="40" stroke="black"
stroke-width="2" fill="red"/>
</svg>

嘗試一下»

對於Opera用戶: 查看SVG文件 (右鍵單擊SVG圖形預覽源)。

代碼解析:

  • cx和cy屬性定義圓點的x和y坐標。 如果省略cx和cy,圓的中心會被設置為(0, 0)
  • r屬性定義圓的半徑