stroke

stroke 属性定义了给定图形元素的外轮廓的颜色。它的默认值是 none

用法

类别 外观属性
<paint>
可变性

示例

SVG 描边的线

示例 1:用 stroke 属性画一条绿色的直线

html
<svg height="50" width="300">
  <path stroke="green" d="M5 20 1215 0" />
</svg>

示例 2:用 Stroke 属性画一个拥有蓝色边框的黑色的圆形

html
<svg height="200" width="200">
  <circle cx="50" cy="50" r="40" stroke="blue" stroke-width="2" fill="black" />
</svg>

元素

下列元素可以使用stroke属性:

规范

Specification
Scalable Vector Graphics (SVG) 2
# SpecifyingStrokePaint