The stroke-dasharray
attribute is a presentation attribute defining the pattern of dashes and gaps used to paint the outline of the shape;
Note: As a presentation attribute stroke-dasharray
can be used as a CSS property.
As a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <altGlyph>
, <circle>
, <ellipse>
, <path>
, <polygon>
, <polyline>
, <rect>
, <text>
, <textPath>
, <tref>
, and <tspan>
<svg viewBox="0 0 30 10" xmlns="http://www.w3.org/2000/svg"> <!-- No dashes nor gaps --> <line x1="0" y1="1" x2="30" y2="1" stroke="black" /> <!-- Dashes and gaps of the same size --> <line x1="0" y1="3" x2="30" y2="3" stroke="black" stroke-dasharray="4" /> <!-- Dashes and gaps of different sizes --> <line x1="0" y1="5" x2="30" y2="5" stroke="black" stroke-dasharray="4 1" /> <!-- Dashes and gaps of various sizes with an odd number of values --> <line x1="0" y1="7" x2="30" y2="7" stroke="black" stroke-dasharray="4 1 2" /> <!-- Dashes and gaps of various sizes with an even number of values --> <line x1="0" y1="9" x2="30" y2="9" stroke="black" stroke-dasharray="4 1 2 3" /> </svg>
Value |
none | <dasharray> |
---|---|
Default value | none |
Animatable | Yes |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | ? | ? | ? | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | ? | ? | ? | ? | ? | ? |
Specification | Status | Comment |
---|---|---|
Scalable Vector Graphics (SVG) 2 The definition of 'stroke-dasharray' in that specification. | Candidate Recommendation | Definition for shapes and texts |
Scalable Vector Graphics (SVG) 1.1 (Second Edition) The definition of 'stroke-dasharray' in that specification. | Recommendation | Initial definition for shapes and texts |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray