Browse documentation
Reference / SVG
Stroke width
Choose the thickness of an SVG outline in its own coordinate system.
Working example
A unitless stroke width scales with the viewBox. Set vector-effect="non-scaling-stroke" on a path when its line weight should stay fixed as the graphic scales.
<svg viewBox="0 0 48 24" role="img" aria-label="Thin and thick horizontal rules"
class="w-28 fill-none stroke-black">
<path d="M3 7h42" class="stroke-1"/>
<path d="M3 17h42" class="stroke-[3]"/>
</svg>Class reference
| Class | CSS declarations |
|---|---|
stroke-0 | stroke-width: 0; |
stroke-1 | stroke-width: 1; |
stroke-2 | stroke-width: 2; |
stroke-[1.5] | stroke: 1.5; |
stroke-[3px] | stroke-width: 3px; |
View full generated CSS
.stroke-0 {
stroke-width: 0;
}
.stroke-1 {
stroke-width: 1;
}
.stroke-2 {
stroke-width: 2;
}
.stroke-\[1\.5\] {
stroke: 1.5;
}
.stroke-\[3px\] {
stroke-width: 3px;
}