I have a <div> with a black background containing a white <h1> element. My <div> has an opacity of .4 using the following css combined with IE’s method.
opacity: .4;
filter: alpha(opacity=40);
This makes my <div> and <h1> have 40% transparency, but I want the h1 to have full transparency (white). How can I accomplish this with equal browser support? Thanks in advance!
P.S. I would use background:rgba(0,0,0,.4); but that’s not something IE supports.
This is not possible – opacity values smaller than 1 can’t be overridden by children.
The
h1would have to be in a different container than thediv, or you would have to use a transparent PNG with 40% opacity for the background (which again won’t work in IE6 without workarounds).