Stroke Width
Controls the width of a stroke in SVG shapes.
Widely available
This feature is well established and works across many devices and browser versions.
Chrome
Edge
Firefox
Safari
| Class | Style |
|---|---|
sw-0 | stroke-width: 0; |
sw-1 | stroke-width: 1; |
sw-2 | stroke-width: 0.2; |
sw-4 | stroke-width: 0.4; |
sw-6 | stroke-width: 0.6; |
sw-8 | stroke-width: 0.8; |
This example showcases various stroke-width utilities:
- The sw-2 stroke width utility sets the stroke width to
0.2to an SVG element. - The sw-6 stroke width utility sets the stroke width to
0.6to an SVG element. - The sw-1 stroke width utility sets the stroke width to
1to an SVG element.
<div class="d-g g-16 gtc-1 sm:gtc-3"> <div> <svg class="d-16 s-slate sw-2"> <path d="..." /> </svg> </div> <div> <svg class="d-16 s-slate sw-6"> <path d="..." /> </svg> </div> <div> <svg class="d-16 s-slate sw-1"> <path d="..." /> </svg> </div></div>Using utility variants
Learn how to override existing utilities based on the user's screen size or other factors, such as hover states.
Targeting different viewports
You can combine responsive breakpoints like sm:sw-*, md:sw-*, lg:sw-*, and xxl:sw-* to allow targeting specific utilities in different viewports.
Targeting hover states
Alternatively, you can apply :hover by using h:sw-* utility to override elements and change their values when hovering over them.