CSS stroke-dasharray property
Browser support · legacy reference
ChromeFully supports
SafariFully supports
FirefoxFully supports
Internet ExplorerFully supports
EdgeFully supports
OperaFully supports
Description
CSS stroke-dasharray defines a pattern of dashes for stroke path.
Syntax
stroke-dasharray : none | length | percentage
Property values
noneDefault
-
It represents a continuous pattern of dashes for a stroke path.
- Try it
stroke-dasharray: none; length
-
The stroke pattern consists of alternate dashes separated by equal sized spaces. 20px means the pattern consists of dashes each having 20px size. They are separated by the same size as of dashe size i.e. 20px.
- Try it
stroke-dasharray: 20px; length length
-
The stroke pattern consists of alternate dashes separated by equal sized spaces. The two values represent the sizes of dashes and spaces respectively. 40px 10px means the pattern consists of dashes each having 40px size. The dashes are separated by 10px space.
- Try it
stroke-dasharray: 40px 10px; percentage
-
It represents the size of dashes in percentage. The dashes repeat themselves along the stroke path in an alternate manner.
- Try it
stroke-dasharray: 5%;
Applicable to
It applies to inline boxes and SVG shapes.