2009-10-21 76 views

回答

4

您需要在橙色框中設置z-index,因爲這是包含黃色框的那個。在IE6/7中,黃色框只會比橙色容器內的其他元素具有更高的Z-index。

#orange { 
    position: relative; 
    z-index: 1; 
    background-color: orange; 
} 
#blue { 
    background-color:blue; 
    height:100px; 
    overflow:hidden; 
    position:relative; 
    width:300px; 
} 
1

指定的z-index爲藍盒子明確:

#yellow { 
background-color: yellow; 
width: 100px; 
height: 150px; 
position: absolute; 
z-index: 200; 
} 

#blue { 
width: 300px; 
height: 100px; 
overflow: hidden; 
background-color: blue; 
position: relative; 
z-index: 100; 
} 

更妙的是,指定z-index的所有三個框,以消除任何瀏覽器誤解。