CSS stroke Property
Description
The stroke property controls the paint used to draw the outline of vector shapes and glyphs — essentially the “pen” that traces a path. In SVG and other vector contexts it defines the visual paint (solid color, gradient, or pattern) applied to the path that forms the boundary of shapes such as
The appearance produced by a stroke depends heavily on several companion properties that govern thickness, edges and dash patterns: for thickness you combine it with stroke-width; the shape of end caps is set by stroke-linecap; corner joins are controlled via stroke-linejoin; dashed outlines come from stroke-dasharray; and global transparency can be adjusted with stroke-opacity. In typical composition, stroke is often used together with fill so that an element can have a painted interior and a distinct outline; the visual balance between fill and stroke is a central aspect of vector styling.
Rendering details matter for how a stroke ultimately looks. By default a stroke is painted centered on the geometry of the path, so half the stroke’s visual thickness lies inside the shape and half outside — that interaction affects how adjacent strokes overlap and how joins appear at corners. The order in which stroke and fill are painted can change the final look; that order can be influenced by paint-order. For cases where transforms must not scale the stroke thickness, a vector-specific control such as vector-effect can be used to change how the stroke responds to transforms. These rendering behaviors make stroke a powerful tool for icons, diagrams, and typographic outlines, but also mean designers must consider how stroke metrics interact with path geometry and composition.
In practical use, designers combine stroke with line-cap and line-join settings to achieve crisp corners and smooth terminals, or with dash settings to create patterned or animatable outlines. Because stroke is fundamentally a paint applied to a path rather than a box-model border, techniques that work for CSS boxes (such as borders) are not a substitute for true vector strokes when precision on curves and joins is required.
Definition
- Initial value
- See individual properties
- Applies to
- SVG content
- Inherited
- Yes
- Computed value
- See individual properties
- Animatable
- See individual properties
- JavaScript syntax
- object.style.stroke
Syntax
stroke: <paint>
Values
- <paint>The <paint> value defines how the stroke is painted and can be one of the following:
- Color values - such as: red, #ff0000, rgb(255, 0, 0), hsl(0, 100%, 50%)
- none - no stroke
- currentColor - inherits the element’s text color
Example
Browser Support
The following information will show you the current browser support for the CSS stroke property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
