IE透明div中的z-index问题

Pre*_*eli 20 html css internet-explorer z-index

我有一个透明的div元素,z-index比同一页面上的img-element更高.但是,当涉及到点击事件时,Internet Explorer就像img-element将具有更高的z值一样.

<!DOCTYPE html>
<html>
<head>
    <title>Demo</title>
</head>
<body style="margin:0;padding:0;">
    <img src="7player.png" alt="7player" width="60" height="60" style="position:absolute; left: 100px; top: 100px; z-index:10" />
    <div style="width:100%;height:100%;position:absolute;z-index:900;" onclick="alert('hello');"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当点击图像时,没有任何事情发生,而应该触发div元素的click事件(例如在Chrome中工作).

是否有任何解决方法或修复我的问题?

Mo *_*our 22

事实上,你的div"没有任何背景",

你需要给它一个不透明度= 0.01的彩色背景(例如白色).

例如:

 background:white; filter:alpha(opacity=1);
Run Code Online (Sandbox Code Playgroud)

  • _background:transparent_没有效果,但使用带有alpha过滤器的颜色确实有效,感谢您的建议:_background:white; filter:alpha(opacity = 1); _ _height = 100%_完美无缺. (2认同)