2015-11-26 24 views
0

標題單格可能會有點誤導,但我並不知道如何短語我的問題正確... 所以在這裏,它是:的z-index內另一個

.header { 
 
\t height:1000px; 
 
\t width:400px; 
 
\t background-color:red; 
 
\t z-index:0; 
 
    color:blue; 
 
} 
 
.text { 
 
    position:fixed; 
 
} 
 
.page { 
 
\t height:1000px; 
 
\t width:400px; 
 
\t padding:20px; 
 
\t background-color:black; 
 
\t z-index:0; 
 
} 
 

 
.container { 
 
\t height:150px; 
 
\t width:350px; 
 
\t background-color:white; 
 
\t z-index:20; 
 
}
<div class="header"><span class=text>Hello</span></div> 
 

 
<div class="page "> 
 
\t <div class="container"></div> 
 
</div>

所以我想在這裏做什麼,很簡單,有「你好」的文字在紅色和黑色的div,因爲它已經是,但在白色的div ...這只是一個z的問題 - 我認爲,但我不知道一種方法...

+0

的z-index確實在靜態定位的元素罷了。 – todinov

回答

3
.container { 
    height: 150px; 
    width: 350px; 
    position: relative; 
    background-color: white; 
    z-index: 20; 
} 

只需position:relative屬性添加到.container DIV :)