Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!

« SVG Attribute reference home

The stroke attribute defines the color of the outline on a given graphical element. The default value for the stroke attribute is none.

Usage context

Categories Presentation attribute
Value <paint>
Animatable Yes
Normative document SVG 1.1 (2nd Edition)

Example

SVG Line with stroke

Example1: Draw straight green line using stroke.

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

Example2: Draw black circle with blue border using stroke.

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

Elements

The following elements can use the stroke attribute

文件標籤與貢獻者

 此頁面的貢獻者: tonedef, ntinsley78, elindie, netsurfer912, Jeremie
 最近更新: tonedef,