CSS3 opacity
Property
Topic: CSS3 Properties ReferencePrev|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:
The example below shows the opacity
property in action.
Example
Try this code »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.
Basic Support—
|
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.