簡體   English   中英

如何將DIV2帶到WRT DIV1的頂部?

[英]How to bring DIV2 to top WRT DIV1?

我正在嘗試將DIV2置於DIV1之上,我沒有關注先前的幾個問題,但似乎沒有任何事情可以解決我的問題。

以下是其CSS對應的DIV元素。

這就是指DIV1

 <div class="left_black_out"><img alt=" close" src="./img/slider_in.png" style="background:none rgba(255,255,255,0.8); opacity:.3">
      <div class="world" >
        <h2>WORLD ABOVE THE WORLD</h2>
        <p>THIS IS IN TOP</p>
        </div>
    </div>

這是DIV2

<div class="disclaimer4" id="basic-modal-content">
  <h3>Disclaimer</h3>
  <p>Want this on TOP</p>
</div>

對應的CSS

.left_black_out {
    background:none rgba(0, 0, 0, 0.8);
    zoom:1;
    bottom: 0;
    display: block;
    height:100%;
    left: -660px;
    top:30px;
    padding: 100px 60px 30px;
    position: absolute;
    width: 800px;
    z-index: 9990;
    /*overflow:hidden;*/
    float: left;    
    margin-top:-30px;   
}

.disclaimer4 {
    position: absolute;
    opacity: .99
    z-index: 9999;
    overflow:hidden;
    float: left;    
}

如果我將位置更改為“相對”,則DIV1完全消失。 我嘗試了DIV2的z索引的其他值,包括負值。 仍然無法使其達到最高水平。 如何做到這一點。

您的答案:小提琴鏈接

.left_black_out {
background:none rgba(0, 0, 0, 0.8);
zoom:1;
bottom: 0;
display: block;
height:100%;
left: -660px;
top:30px;
padding: 100px 60px 30px;
position: absolute;
width: 800px;
z-index: -9990;
float: left;    
margin-top:-30px;   

}

更改.left_black_out的z索引為負(-9990;)

索引

試試這個

.left_black_out {
    background:none rgba(0, 0, 0, 0.8);
    zoom:1;
    bottom: 0;
    display: block;
    height:100%;
    left: -660px;
    top:30px;
    padding: 100px 60px 30px;
    position: absolute;
    width: 800px;
    float: left;    
    margin-top:-30px; 
    z-index:0;
}

.disclaimer4 {
    position: absolute;
    overflow:hidden;
    float: left; 
    background:#fff;
    z-index:1;
    opacity:0.9;
}

http://jsfiddle.net/a3WSm/4/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM