CSS/Properties/opacity

From W3C Wiki
< CSS‎ | Properties
Revision as of 22:41, 21 July 2011 by Plehegar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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>

Css3 colors opacity 001.png

CSS Reference

CSS Color defines the opacity property in 3.2. Transparency: the ‘opacity’ property.