Monday, June 29, 2009

Creating Transparency

To create a transparent region using css. Use the following
<style>
#image1 {opacity:0.4;filter:alpha(opacity=40);}
</style>


opacity is used by firefox and other modern browsers and has the value 0 - 1 (ie. 0.5 is a valid entry). 0 being the most transparent.

filter:alpha(opacity=40) is used by internet explorer and opacity can have value 0 - 100 (0 being the most transparent).






Image at 40% transparency

To make an object in javascript transparent use the following code (where 0.8 and 80 represent 80% transparency)

style.opacity=0.8;

style.filter="alpha(opacity=80)";

No comments:

Post a Comment