CSS Reference

"opacity" - css (v. css 3)

  • Set the opacity level for a element.
  • A value, between '0' and '1' or inherit.
  • Initial value: 1
  • The is not inherited
  • HTML usage: all elements
  • Browsers that support the opacity - :
    Internet Explorer Mozilla Firefox Opera Google Chrome Apple Safari
    Browser deviation:
    • IE8 and earlier versions supports an alternative, the filter property.
      Like: filter:Alpha(opacity=20).
Typical usage:
div   { opacity: 0.7; }

"opacity" example:

<!DOCTYPE html>
<html>
  <head>
    <style> 
      p {
        background-color: red;
        opacity: 0.7;
        filter: Alpha(opacity=70); 
        /* IE8 and earlier */
      }
    </style>
  </head>
  <body>

    <p>This element's opacity is 0.7! Both the text and the background-color are affected by the opacity.</p>

  </body>
</html>

Javascript access:

// To SET values ([o] is the target object)
[o].style.opacity="0.6"
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.