html - IE9/IE10 - 透明度问题

标签 html css internet-explorer

我有一个页面,其中有一个位于另一个 div 之上的 div。顶部的div在大多数地方都设置为透明的,并且不捕获指针事件。我知道 IE 9 和 10 不支持 CSS pointer-events 属性,但是当底层 div 没有任何内容时,我在 IE 9 和 10 中看到一些奇怪的行为。在那些情况下,它根本不抓取鼠标事件。如果有边框或一些文本内容悬停在边框或内容上,但在元素的空白处不起作用。我试过使用透明背景图像,但这似乎不起作用。我已将链接附加到重现问题的基本 fiddle 。

HTML:

<div class="topElement"></div>
<div class="bottomElement">Works in IE 9 and 10 only if you hover over text or border.</div>

CSS:

.topElement {
    position:absolute;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    z-index: 2;
}
.bottomElement {
    position:absolute;
    width: 100%;
    height: 100%;
    border: 3px solid black;
    background: transparent 0 0 repeat scroll url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBR??AA7");
}
.bottomElement:hover {
    background-color: red;
}

http://jsfiddle.net/MLundin617/jpr3j8jb/4/

当您将鼠标悬停在该区域上时,该区域应该会变成红色。

最佳答案

您必须将 z-index 写入 ".bottomElement">=2

关于html - IE9/IE10 - 透明度问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25185941/

相关文章:

html - 导航在 Firefox 中显示略有不同

html - 使下拉子项成为容器的 100%

html - 在 css 中悬停有问题

html - 对齐背景图像中心,并相对上下(垂直)调整

javascript - Bootstrap 数据切换的 "active state"叫什么?

html - 如何在没有固定父高度的情况下调整 div 高度以匹配兄弟 img 高度

html - CSS - 波浪边框

javascript - 在 IE 中禁用源映射

html - IE9 忽略同一样式表中的 *some* 媒体查询

javascript - 消息 : System error: -1072896658 ---- Problem with IE browser