我有以下代碼,並希望內部div與類:escaping-container將顯示在外部div與類容器的前面。內部div應該顯示在外部div前
內部div比外部div有更大的高度設置。所以它的一部分被切斷了。
此外,必須顯示被外部div切割的部分。
<style type="text/css">
div.container{
width: 100px;
height:100px;
overflow-x:scroll;
overflow-y:hidden;
position:relative;
z-index:1;
}
div.escaping-container{
width:50px;
height:150px;
position:relative;
z-index:10;
background-color:red;
}
</style>
<div class ="container">
<div class="escaping-container"></div>
</div>
我試圖通過設置z-index來完成此操作,但它不起作用。任何幫助將不勝感激。
你所需要的'溢出x'和'溢出y'屬性?如果不是,請嘗試刪除它們。 – anroesti
是的,不幸的是溢出設置是必要的。 –
這是一個jsfiddle:http://jsfiddle.net/jasongennaro/28RWW/。什麼不在這裏工作? –