opacity()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.
The opacity() <filter-function>.
Try it
filter: opacity(1);
filter: opacity(80%);
filter: opacity(50%);
filter: opacity(0.2);
filter: opacity(0);
<section id="default-example">
<img
class="transition-all"
id="example-element"
src="/shared-assets/images/examples/firefox-logo.svg"
width="200" />
</section>
Note:
This function is similar to the more established opacity property. The difference is that with filters, some browsers provide hardware acceleration for better performance.
Syntax
css
opacity(amount)
Parameters
amountOptional-
The amount of the conversion, specified as a interpolation is
1. The default value is1.
Formal syntax
<opacity()> =
opacity( <percentage> ? )
Examples
>Examples of correct values for opacity()
css
opacity(0%) /* Completely transparent */
opacity(50%) /* 50% transparent */
opacity() /* No effect */
opacity(1)
Specifications
| Specification |
|---|
| Filter Effects Module Level 1> # funcdef-filter-opacity> |
Browser compatibility
See also
- The other
backdrop-filterproperties include: - The CSS
opacityproperty