CSS stroke-dasharray property

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.

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.

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.

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.

stroke-dasharray: 5%;

Applicable to

It applies to inline boxes and SVG shapes.

#CSS digger
Was this article helpful?

 
×

Ctrl+D