我想分層多個div,這樣每個連續的div都向上偏移並位於它前面的左側。它應該大致看起來像一堆文件。我嘗試過使用絕對定位和Z-index,但是定位似乎並不好。這裏有一個Fiddle
如何定位重疊的div以使其看起來像一疊紙?
.box{
width:100px;
height:100px;
border-style:solid;
border-color: #D3D3D3;
position:absolute;
}
.first{
background-color:yellow;
z-index:10;
bottom:0;
right:0;
}
.second{
background-color:blue;
z-index:9;
bottom:10;
right:10;
}
.third{
background-color:red;
z-index:8;
bottom:20;
right:20;
}
.background{
height:100%;
background-color:green;
position:relative;
z-index:0;
}
.container{
border-style:solid;
border-color:black;
width:300px;
height:300px;
position:relative
}
<div class="background">
<div class="container">
<div class="box first"></div>
<div class="box second"></div>
<div class="box third"></div>
</div>
</div>
現在好了,我感覺很傻。好,趕快,謝謝! – GetOffMyLawn