Transparency (opacity)
2012/02/23 Css resources, examples & tutorials for webmasters and online professionals
Transparency (opacity)
img{ opacity: 0.5; filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; } Most modern browsers handle css transparency (opacity) pretty well.
In an ideal world the css statement for opacity should be (the official css standard):
opacity: 0,5;
where the value is between 0 (full transparency) and 1 (no transparency).
The latest firefox, safari and chrome browsers handle this pretty well. Obviously Internet Explorer does not.
To make this work in all browsers, use the following combination:
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
The different variations are for:
- filter:alpha(opacity=50)
This is needed for Internet Explorer where the value is between 0 and 100. - -moz and -khtml
are for older Safari and Firefox browsers, but are not needed for recent versions.
Leave a reply.