Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS3 opacity property

CSS3 opacity property

Example

Set the opacity level of a div element:

div

{

opacity:

0.5

;

}

Try it »

There are more examples at the bottom of this page.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the opacity property.

**Note:** IE8 and earlier versions support an alternative filter property, such as: filter:Alpha(opacity=50)


Property definition and usage

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.