[英]“:hover to change z-index” not working in IE8
I have created a stack of div tags and used z-indexes to make them appear behind each other. 我创建了一个div标签堆栈,并使用了z-indexs使它们彼此相邻。
They overlap enough for them all to be visible and mouse-overable. 它们重叠得足够多,以至于所有人都可以看到并且可以通过鼠标覆盖。 I then assigned a :hover to change the z-index and make the div tag which is being hovered over come to the top of the pile.
然后,我分配了一个:hover来更改z-index,并使正在悬停的div标签到达堆的顶部。
An example of what I have would be... 我所拥有的一个例子是...
CSS 的CSS
#red-box {
position:fixed;
width:170px;
height:210px;
margin-left:70px;
top:40px;
background-color:red;
z-index:3;
}
#red-box:hover {
z-index:5;
}
#blue-box{
position:fixed;
width:170px;
height:210px;
margin-left:150px;
top:70px;
background-color:blue;
z-index:2;
}
#blue-box:hover{
z-index:5;
}
HTML 的HTML
<a id="red-box"></a>
<a id="blue-box"></a>
I have also created a jsFiddle to help highlight what's going on. 我还创建了一个jsFiddle以帮助突出显示正在发生的事情。
This works great in the latest versions of all the browsers but the div tags' z-indexes do not change in IE8. 这在所有浏览器的最新版本中都很好用,但是div标记的z索引在IE8中不会更改。
Could anyone help me fix it? 谁能帮我解决这个问题?
This ought to fix it: http://brenelz.com/blog/squish-the-internet-explorer-z-index-bug/ 这应该解决它: http : //brenelz.com/blog/squish-the-internet-explorer-z-index-bug/
Basically, just set it to a ridiculously high number. 基本上,将其设置为一个高得离谱的数字。
Edit: I just tested this in my version of IE on your JSFiddle, and it worked. 编辑:我刚刚在您的JSFiddle上的IE版本中对此进行了测试,并且可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.