CSS fill-opacity Property
Description
The fill-opacity property controls the transparency of the fill painting applied to SVG shapes and text. It adjusts only the alpha channel of the element’s fill, so it directly affects how much of the underlying content shows through the fill area while leaving geometric attributes (like shape, stroke width, or position) unchanged. When you set fill-opacity, you are modulating the fill paint itself rather than the element as a whole, which makes it useful for creating layered visual effects where the interior of a shape should be translucent but other aspects remain fully visible. The effective color used for filling is the computed fill color combined with this opacity value; see the fill property for how the fill paint is determined.
Because fill-opacity only affects the fill’s alpha, it composes multiplicatively with other transparency sources. For example, the element’s overall opacity multiplies with the fill’s computed alpha to produce the final pixel transparency, and stroke transparency is controlled independently via stroke-opacity. In practice this means you can fade just the interior of a shape (using fill-opacity) while leaving its outline fully opaque, or vice versa, without changing color values themselves.
Painting order can change visual results when transparency is involved. Whether the fill is drawn before or after the stroke (or other paint operations) affects how overlapping transparent regions blend; that is governed by the paint-order property. Note that fill-opacity affects only rendering: it does not alter layout, geometry, or the element’s ability to receive events. Transparent pixels produced by fill-opacity are still part of the painted region unless pointer-event handling is changed separately.
In practical use, fill-opacity is a straightforward tool for layering, subtle shading, overlays, and hover or focus visuals that target just the fill. It’s commonly animated or transitioned when you want the interior to fade in or out while preserving stroke or child-element appearance; if you instead animate the entire element’s transparency, use the overall opacity property to affect the element and its descendants together.
Definition
- Initial value
- 1
- Applies to
- SVG shapes and text content elements
- Inherited
- yes
- Computed value
- The same as the specified value after clipping the <number> to the range [0.0, 1.0].
- Animatable
- by computed value type
- JavaScript syntax
- object.style.fillOpacity
Syntax
fill-opacity: <number>;
Values
- <number>A number between
0and1(inclusive) representing the opacity level.0→ fully transparent1→ fully opaque0.5→ 50% opacity (semi-transparent)
Example
Browser Support
The following information will show you the current browser support for the CSS fill-opacity 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
