Make an image transparent in IE to show non-transparent background
Posted
by Select0r
on Stack Overflow
See other posts from Stack Overflow
or by Select0r
Published on 2010-04-08T10:33:23Z
Indexed on
2010/04/08
10:53 UTC
Read the original article
Hit count: 473
Hi,
I'm trying to get this thing to work in IE (any version - works in FF, Opera, Safari, Chrome ...):
I have a DIV with a background-image. The DIV also contains an image that should be transparent onMouseOver. The expected behaviour now is that the DIV-background would shine through the transparent image (which it does in all browsers but IE).
Instead it looks like the image is getting transparent but on a white background, I can't see the DIV's background through the image.
Here's some code:
<div><a href="#" class"dragItem"><img /></a></div>
And some CSS:
.dojoDndItemOver {
cursor : pointer;
filter : alpha(opacity = 50);
opacity : 0.5;
-moz-opacity : 0.5;
-khtml-opacity : 0.5;
}
.dragItem:hover {
filter : alpha(opacity = 30);
opacity : 0.3;
-moz-opacity : 0.3;
-khtml-opacity : 0.3;
background : none;
}
All of this is embedded in a Dojo Drag-n-Drop-system, so dojoDndItemOver
will automatically be set to the DIV on MouseOver, dragItem
is set to the href around the image (using the same class on the image directly doesn't work at all as IE doesn't support "hover" on other items that href).
Any ideas? Or is it an IE-speciality to just "simulate" transparency on images by somehow just greying them out instead of providing real transparency and showing whatever is beneath?
© Stack Overflow or respective owner