Style opacity property
- 上一页 objectPosition
- 下一页 order
- 返回上一层 HTML DOM Style Object
Definition and usage
opacity
The property sets or returns the opacity level of the element.
The opacity level (opacity-level) of the element describes the transparency level, where 1
Fully opaque,0.5
Represents 50% transparent,0
Represents fully transparent.
See also:
CSS Reference Manual:Opacity property
Example
Make the DIV element transparent:
document.getElementById("myDIV").style.opacity = "0.5";
Syntax
Return opacity property:
object.style.opacity
Set opacity property:
object.style.opacity = "number|initial|inherit"
Property value
Value | Description |
---|---|
number | Specify opacity. From 0.0 (fully transparent) to 1.0 (fully opaque). |
initial | Set this property to its default value. See also initial。 |
inherit | Inherit this property from its parent element. See also inherit。 |
Technical details
Default value: | 1 |
---|---|
Return value: | 字符串,表示元素的不透明度级别。 |
CSS 版本: | CSS3 |
浏览器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 |
- 上一页 objectPosition
- 下一页 order
- 返回上一层 HTML DOM Style Object