CSS3 opacityProperty
Example
Set the opacity level of a div element:
div
{
opacity:0.5;
}
Try it Yourself »
More examples at the bottom of this page.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the opacity property.
Note:IE8 and earlier versions support another filter property. Like: filter:Alpha(opacity=50)
Attribute definition and usage instructions
The opacity property sets the opacity level of an element.
| Default value: | 1 |
|---|---|
| Inherited: | no |
| version: | CSS3 |
| JavaScript Syntax: | object.style.opacity=0.5 |
Syntax
opacity: value|inherit;
| Value | Description |
|---|---|
| value | Specifies the opacity. From 0.0 (fully transparent) to 1.0 (fully opaque) |
| inherit | The value of the Opacity property should be inherited from the parent element |
More Examples
Change the opacity of an element
This example demonstrates how to use JavaScript to change the opacity of an element.