CSS3 opacity property
Examples
Set the transparency level of a div element:
div
{
opacity: 0.5;
}
{
opacity: 0.5;
}
try it"
In the bottom of this page for more examples.
Browser Support
All major browsers support opacity property. .
Note: IE8 and earlier versions support another filter properties. Like: filter: Alpha (opacity = 50)
Attribute definitions and instructions
Opacity property is set to a transparency element level.
Defaults: | 1 |
---|---|
inherit: | no |
version: | CSS3 |
JavaScript syntax: | object .style.opacity = 0.5 |
grammar
opacity:value|inherit;
值 | 描述 |
---|---|
value | 指定不透明度。从0.0(完全透明)到1.0(完全不透明) |
inherit | Opacity属性的值应该从父元素继承 |
More examples
Change the opacity of an element
This example demonstrates how to use JavaScript to change the element of opacity.