Style opacity Property
Example
Make the DIV element semi-transparent:
document.getElementById("myDIV").style.opacity="0.5";
Try it »
Definition and Usage
The opacity property sets or returns the opacity of an element.
The opacity level of an element describes its level of transparency. When opacity is 1, it means completely opaque; when opacity is 0.5, it means semi-transparent; when opacity is 0, it means completely transparent.
Browser support

All major browsers support the opacity property.
**Note:** IE8 and earlier versions support an alternative property, the filter property.
Syntax
Return the opacity property:
object
.style.opacity
Set the opacity property:
object
.style.opacity="
number
|initial|inherit"
Attribute values
| Value | Description |
|---|---|
| number | Specifies the opacity. From 0.0 (completely transparent) to 1.0 (completely opaque). |
| initial | Sets this property to its default value. See initial. |
| inherit | Inherits this property from its parent element. See inherit. |
Technical Details
| Default value: | 1 |
|---|---|
| Return Value: | A string representing the element's opacity property. |
| CSS version | CSS3 |
Related Articles
CSS Reference Manual:opacity property
The Style object