Reputation: 152777
How to give cross browser transparency to background only?
I want to give transparency to background of ul { background: }
only don't want to make text inside ul li a {}
transparent.
ul {
filter: alpha(opacity=50); /* internet explorer */
-khtml-opacity: 0.5; /* khtml, old safari */
-moz-opacity: 0.5; /* mozilla, netscape */
opacity: 0.5; /* fx, safari, opera */
}
this code make everything transparent http://perishablepress.com/press/2009/01/27/cross-browser-transparency-via-css/
Upvotes: 1
Views: 2391
Reputation: 31249
you can use RGBA colors. I have made up an example for you:
ul {
background: rgba(255, 255, 255, 0.5) //white with opcaity of 50%
}
ul li {
color: #fff;
background: rgba(0, 0, 0, 0.5) //black with opcaity of 50%
}
here is a workaround for IE and the compatibly list: http://css-tricks.com/rgba-browser-support/
Upvotes: 3