CKTIS / CSS
fill — SVG interior paint
The fill property specifies how the interiors of SVG shapes and text glyphs are painted. It accepts a color, gradient, or pattern, or disables interior painting with none.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
fill: <paint>;
<paint> = none | <color> | <url> [ none | <color> ]? | context-fill | context-strokefill paints the interiors of SVG shapes and text, whereas stroke paints their outlines. In the SVG 2 model, it is inherited and initially black.
none disables interior painting; currentColor uses color. The value url(#paint) red references a gradient or pattern, with red as a fallback, not an additional layer. context-fill and context-stroke obtain paint from a context element; without one, they apply no paint.
fill-rule determines the interior of complex paths. Open subpaths are treated as closed for filling.
The supplied syntax describes SVG 2. The CSS Fill and Stroke Level 3 draft describes a broader shorthand including fill-color and fill-image; do not treat that draft as evidence of browser support.
Examples
<!doctype html>
<meta charset="utf-8">
<title>fill</title>
<style>
svg { color: #0066cc; fill: currentColor; }
.outline { fill: none; stroke: #0066cc; stroke-width: 4; }
</style>
<svg xmlns="http://www.w3.org/2000/svg" width="180" height="80" viewBox="0 0 180 80" role="img" aria-label="fill">
<rect x="10" y="10" width="60" height="60" />
<rect class="outline" x="100" y="10" width="60" height="60" />
</svg>Result
Left: a solid blue square (#0066cc). Right: a square with a blue 4-unit outline and no interior paint.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.