CSS opacity Property

❮ Previous Reference Next ❯


img {
  opacity: 0.5;

p {
  opacity: 0.1;



The opacity property sets the opacity of an element.

Opacity is the degree to which content behind an element is hidden, and is the opposite of transparency.

0.0 is fully transparent and 1.0 fully opaque.

Default value:1
JavaScript syntax:

Standard Syntax

opacity: number|initial|inherit|revert|revert-layer|unset;

Browser Support

The numbers in the table specify the first browser version that fully supports the property.


Property Values

The following table describes the values of this property.

Value Description
number Specifies the opacity.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.

Default CSS Property Values

selectors {
  opacity: 1;
❮ Previous Reference Next ❯