我正在嘗試使用css製作迷你網格帖子佈局。但我有一個divs的問題。我已經嘗試在這demo頁面。而我沒有得到我想要的形狀。我想讓它像截圖Grid Box在divs之間切換
我試着像這樣的CSS代碼:
.div {
position:relative;
float:left;
width:100%;
border-radius:5px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
background-color:#1d1f20;
}
.div:nth-child(1){
width:180px;
padding-top:180px;
margin-right:5px;
margin-bottom:5px;
}
.div:nth-child(2){
width:180px;
padding-top:180px;
margin-right:5px;
margin-bottom:5px;
}
.div:nth-child(3){
width:400px;
padding-top:400px;
margin-right:5px;
margin-bottom:5px;
}
.div:nth-child(4){
width:180px;
padding-top:180px;
margin-right:5px;
margin-bottom:5px;
}
.div:nth-child(5){
width:365px;
padding-top:180px;
margin-right:5px;
margin-bottom:5px;
}
.div:nth-child(6){
width:180px;
padding-top:180px;
margin-right:5px;
margin-bottom:5px;
}
HTML
<div class="container">
<div class="div"></div>
<div class="div"></div>
<div class="div"></div>
<div class="div"></div>
<div class="div"></div>
<div class="div"></div>
</div>
我怎樣才能CSS中的截圖?任何人都可以幫助我嗎?
只有CSS或者你可以使用JS/JQuery? – paolobasso
@ paolo.basso99我只想讓它只用CSS。我知道我可以用js做到這一點,但如果可能的話,我只想在CSS中做到這一點。 – Azzo