CKTIS / CSS
stop-opacity — SVG gradient stop opacity
The CSS `stop-opacity` property controls the opacity of an SVG gradient stop. It applies to `stop` elements, allowing a smooth transition from a transparent color to an opaque one.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
stop-opacity: <number> | <percentage>;stop-opacity controls the opacity of a stop element in an SVG linearGradient or radialGradient. Its initial value is 1; it is not inherited and can be animated.
The number 0 means fully transparent, and 1 means fully opaque. Percentages express the same scale: 50% equals 0.5. The computed value is a number clamped to [0,1].
The stop alpha used in the gradient is the product of stop-opacity and the alpha of stop-color. For example, 0.5 with a color alpha of 0.5 produces 0.25. This is not an opacity setting for the entire shape.
In the example, both stops use blue but have different opacity. A white rectangle beneath the gradient provides a defined background: the expected result transitions from white on the left to blue on the right.
Examples
<!doctype html>
<meta charset="utf-8">
<title>stop-opacity</title>
<style>
#fade-start { stop-opacity: 0; }
#fade-end { stop-opacity: 1; }
</style>
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="80" viewBox="0 0 300 80">
<defs>
<linearGradient id="fade" x1="0%" x2="100%">
<stop id="fade-start" offset="0%" stop-color="blue" />
<stop id="fade-end" offset="100%" stop-color="blue" />
</linearGradient>
</defs>
<rect width="300" height="80" fill="white" />
<rect width="300" height="80" fill="url(#fade)" />
</svg>Result
A 300 × 80 rectangle fading from white on the left to blue on the right.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.