stroke-dasharray

Creates dashed or dotted lines for SVG shapes. You provide a list of numbers that define the length of the dashes and the spaces between them.

It is documented as part of the Scalable Vector Graphics specification.

/* Usage Example */
line.dashed-path {
  /* Creates a pattern of 10px dashes and 5px spaces */
  stroke-dasharray: 10 5;
}

/* Syntax */
stroke-dasharray: none;

/* Global values */
stroke-dasharray: inherit;
stroke-dasharray: initial;
stroke-dasharray: revert;
stroke-dasharray: revert-layer;
stroke-dasharray: unset;
Widely available Since 2020 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2020.

1+
1.5+
4+
15+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC