CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS3 opacity Property

Topic: CSS3 Properties Reference« Prev|Next »

Description

The opacity CSS property specifies the transparency of an element.

The following table summarizes the usages context and the version history of this property.

Default value: 1 (opaque)
Applies to: All elements
Inherited: No
Animatable: Yes. See animatable properties.
Version: New in CSS3

Syntax

The syntax of the property is given with:

opacity alphavalue | initial | inherit

The example below shows the opacity property in action.

  • img {
  •     opacity: 0.25;
  • }
  • p {
  •     opacity: 0.5;
  • }

Property Values

The following table describes the values of this property.

Value Description
alphavalue A number in the range 0 (fully transparent) to 1 (fully opaque). Any value smaller or larger is clamped to this range.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element opacity property.

Browser Compatibility

The opacity property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1.7+
  • Google Chrome 1+
  • Internet Explorer 9+
  • Apple Safari 2+
  • Opera 9+
 

Note:Internet Explorer 8 and earlier versions does not support opacity, rather it supports an alternative, the Microsoft-only filter property. Like: filter: Alpha(opacity=50); Learn more about CSS opacity


Further Reading

See tutorial on: CSS Opacity, CSS Color Values.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.