0

即使我添加位置,IE7 z-index 也不起作用:absoluterelative

还有其他解决方案吗?我添加了其他 div 较低的 z-index 但不起作用

.gallery {
    background-color: #F4F4F4;
    display: block;
    min-height: 300px;
    padding: 20px 10px;
    position: absolute;
    right: -44px;
    top: 70px;
    width: 980px;
    z-index: 3000;
    display: none;
}
.sub_menu {
    background-color: #F4F4F4;
    float: left;
    height: 21px;
    padding: 40px 35px;
    position: relative;
    top: 10px;
    width: 930px;
    z-index: 1000;
}
4

2 回答 2

1

z-index和 IE 有时需要使用!important

.gallery {
    background-color: #F4F4F4;
    display: block;
    min-height: 300px;
    padding: 20px 10px;
    position: absolute;
    right: -44px;
    top: 70px;
    width: 980px;
    z-index: 3000 !important;
    display: none;
}
.sub_menu {
    background-color: #F4F4F4;
    float: left;
    height: 21px;
    padding: 40px 35px;
    position: relative;
    top: 10px;
    width: 930px;
    z-index: 1000 !important;
}
于 2013-09-18T17:29:12.630 回答
0
!important 

应该用作最后的结果。

事先尝试以下方法

body{
    z-index: -1
} 

.gallery {
    background-color: #F4F4F4;
    display: block;
    min-height: 300px;
    padding: 20px 10px;
    position: absolute;
    right: -44px;
    top: 70px;
    width: 980px;
    z-index: 2;
    display: none;
 }

.sub_menu {
    background-color: #F4F4F4;
    float: left;
    height: 21px;
    padding: 40px 35px;
    position: relative;
    top: 10px;
    width: 930px;
    z-index: 1;
}
于 2013-09-18T19:59:07.063 回答