Archive for November 10th, 2009
A different way to change css opacity
by z3n on Nov.10, 2009, under Coding, Tips & Hints
I was looking around to fix bugs on IE opacity settings and found out this article, although the rgba don’t work on ie6 <= , it seemed pretty good for me, not only because it’s less code, but it’s smarter; and it’s also an old thing!
On this sample i will have an some_css class with 50% transparency, on the usual method you need to do lots of statements to be compatible with all major browsers, not only that but this makes things harder when you have elements inside the parent element that shouldn’t be transparent.
Problem:
.some_css {
filter:alpha(opacity=50);
opacity:0.5;
-moz-opacity:0.5;
position:relative;
}
Solution:
.some_css {
background-color:rgba(0,0,0,0.5);
}
Source: