IE版本为6.0,代码如下:
<div style="background-color: #4A840F; width:300px; height: 200px; position: relative;">
<div style="background-color: #ED4100; width:200px; height: 500px; position: absolute;z-index: 100;"></div>
</div>
<div style="background-color: red; width:300px; height: 200px; position: relative;"></div>
如果我删除第三个div上的position=relative,一切都好,但我不能,因为我需要它来修复另一个元素。但是,如果不删除它,z-index 在 IE 中不起作用。它适用于 FF 和 chrome。
有人可以帮我解决这个问题吗?预先感谢您。
最佳答案
添加
z-index: 1;
第一个 div 的样式。
在 IE6 中,偏移父级的 z-index 将覆盖其所有子级的 z-index 值。
关于css - z-index 在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4858589/