The first two are variants for Internet Explorer -- although both will currently work, the second was introduced in IE5.5 and is based on ActiveX technology. This will be the only one supported in the future.
Note: On some elements, IE requires the width or height to be given for the opacity to work.
Note 2: Mozilla had support for percentage values before, but not any longer.
---------------------
Need to do this in Javascript? You can use this function to control those attributes dynamically. Note: in IE you'll need to have specified the opacity in the style sheet to access the value from Javascript, even if it starts from 100%. Here's a simple little script for you all!
code:
function setOpacity(which,num) {
if(document.all) document.getElementById(which).filters.alpha.opacity=num;
else if(document.getElementById) document.getElementById(which).style.MozOpacity=num+'%';
}
"which" is the id of the object you want to set the opacity for, and "num" is the percentage. Simple, no?
As of writing this FAQ is number 1 at Google in the search for the terms css, opacity (up from 5 and previously 6) and number 3 for the terms opacity, css. It is also number 2 for the terms css, partially, transparent (up from 3).