stroke-dashoffset
Widely availableSince 202097% of users
Defines where a dash pattern (created with 'stroke-dasharray') starts. By animating this value, you can create the 'self-drawing' line effect commonly seen in SVG animations.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since April 2017. Widely available since October 2019.
See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
0- Inherited
- Yes
- Applies to
- a subset of SVG elements (shapes)
- Animation type
- byComputedValueType
Quick example
path.drawing-line {
stroke-dasharray: 1000;
/* Offsets the pattern so the line appears invisible at first */
stroke-dashoffset: 1000;
transition: stroke-dashoffset 2s;
}
path.drawing-line:hover {
/* Pulls the pattern back to animate the line drawing into view */
stroke-dashoffset: 0;
}stroke-dashoffset browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2020.Safe to use without fallbacks.
Usage97%of people can use this3% use a browser without it.
Browsers
1+
1.5+
4+
≤15+Mobile
18+Android
4+Android
3.2+iOS