跳到主要内容

06、SVG 圆形 <circle>

<circle> 标签可画一个圆

SVG 圆形 - <circle>

<circle> 标签可画一个圆

  • cx 和 cy 属性定义圆点的 x 和 y 坐标。如果省略 cx和 cy,圆的中心会被设置为(0, 0)
  • r 属性定义圆的半径

范例

我们来画一个圆心坐标为 (100,50) 半径为 40 的圆

 

<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 图形预览源)