CSS/Properties/opacity
< CSS | Properties
opacity
The opacity property specifies the opacity of an element.
Description
Values | <alphavalue> | inherit |
---|---|
Initial value | 1 |
Applies to | All elements |
Inherited | No |
Values
<alphavalue>
Syntactically a <number>. The uniform opacity setting to be applied across an entire object. Any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this range.
inherit
Takes the same specified value as the property for the element's parent.
Example
Example A
[style.css]
body { color: #fff; background-color: #666; } h1{ background-color: red; } #op{ opacity: 1.0; } #tr{ opacity: 0.4; }
[index.html]
<body> <h1 id="op">CSS color property example(fully opaque)</h1> <h1 id="tr">CSS color property example(transparent)</h1> </body>
CSS Reference
CSS Color defines the opacity property in 3.2. Transparency: the ‘opacity’ property.