为什么IE7不尊重z-index顺序?

时间:2010-04-27 14:13:46

标签: z-index

  1. #cm_sidebarDIV div具有z-index 3;
  2. .abouttop and .aboutlist div具有z-index 2
  3. 所以#cm_sidebarDiv在Firefox和Chrome中显示时位于顶部,但在EI7中显示在底部。

    #leftmanulist{ background:url("images/abouttop.gif") no-repeat;
    float: left;
    margin: 2px 2px 5px 30px;
    padding:39px 0 0 0;
    width:237px;
    }
    
    #leftmanulist ul li{line-height:35px;text-align:left; text-decoration:none;}
    #leftmanulist ul li a{ text-decoration:none;}
    
    #leftmanulist ul li:hover{ color:#0068FF;}
    #leftmanulist ul li a:hover{ color:#0068FF;}
    
    #leftmanulist ul li.index{ color:#0068FF;}
    #leftmanulist ul li.index a{ color:#0068FF;}
    
      .abouttop{background:url("images/leftmanulist_z.gif") repeat-y ;
        padding:0 6px;  position:relative; z-index:2;
        width:237px;}
    
        .aboutlist{position:relative;left:28px;}
        .aboutbutton{background:url("images/leftmanulist_b.gif") no-repeat;
        width:237px; height:20px; position:relative; top:-17px; z-index:2;}
        .inword{color:#555555;font-size:0.92em;text-align:justify;line-height:24px;letter-spacing:1px; padding:30px 40px 0px 336px; }
    
    
        #cm_sidebarDIV {
            z-index: 3;
        }
    

    有什么建议吗?

3 个答案:

答案 0 :(得分:1)

将#cm_sidebarDIV明确的位置设置为relative或absolute。

答案 1 :(得分:1)

要使z-index正常工作,它必须具有与静态不同的定位设置,这是默认设置。尝试将其更改为相对(或绝对,如果这就是你需要的)。

#cm_sidebarDIV {
    position: relative;
    z-index: 3;
}

答案 2 :(得分:0)

我认为这是IE的神秘现象之一。 我将所有about divs更改为position:static并解决了问题(不确定原因)。