--- title: stroke-dashoffset slug: Web/SVG/Attribute/stroke-dashoffset tags: - 可縮放矢量圖形 - 可縮放矢量圖形 屬性 translation_of: Web/SVG/Attribute/stroke-dashoffset ---
stroke-dashoffset
屬性指定一個數值至虛線的開頭。
如果使用 <percentage> ,值則會代表當前viewport的百分比。
值允許為負值。
類別 | Presentation attribute |
---|---|
可用值 | <percentage> | <length> | inherit |
初始值 | 0 |
可動畫化 | 是 |
規範文件 | SVG 1.1 (2nd Edition) |
<svg width="200" height="200" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg"> <line stroke-dashoffset="0" stroke-dasharray="20" x1="0" y1="10" x2="200" y2="10"/> <line stroke-dashoffset="10" stroke-dasharray="20" x1="0" y1="20" x2="200" y2="20"/> <line stroke-dashoffset="20" stroke-dasharray="20" x1="0" y1="30" x2="200" y2="30"/> <line stroke-dashoffset="50%" stroke-dasharray="20" x1="0" y1="40" x2="200" y2="40"/> <line stroke-dashoffset="25%" stroke-dasharray="20" x1="0" y1="50" x2="200" y2="50"/> <line stroke-dashoffset="0%" stroke-dasharray="20" x1="0" y1="60" x2="200" y2="60"/> </svg>
line{ stroke: #51BBA7; stroke-width: 2; }
{{ EmbedLiveSample('範例') }}
以下元素可以使用 stroke-dashoffset
屬性