Prop Style Opacity
# Style opacity Property
[ Style Object](#)
## Example
Make a DIV element half-transparent:
document.getElementById("myDIV").style.opacity="0.5";
[Try it Yourself Β»](#)
* * *
## Definition and Usage
The opacity property sets or returns the opacity of an element.
The opacity level describes the transparency level, where an opacity of 1.0 is completely opaque, an opacity of 0.5 is half-transparent, and an opacity of 0 is completely transparent.
* * *
## Browser Support

The opacity property is supported in all major browsers.
**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"
## Property 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. Read about _initial_. |
| inherit | Inherits this property from its parent element. Read about _inherit_. |
## Technical Details
| Default Value: | 1 |
| --- |
| Return Value: | A String, representing the opacity property of an element. |
| CSS Version | CSS3 |
* * *
## Related Articles
CSS Reference: (#)
* * Style Object](#)
YouTip