0
我正在嘗試創建流體佈局,但似乎無法將紫色/黑色div定位在正確的位置。如何讓div向上移動,以便填充由以前的div創建的空間。這裏是我的代碼:如何將div放入由另外兩個div創建的間隙中
<body>
<div class="container">
<div class="square-one"></div>
<div class="square-two"></div>
<div class="square-three"></div>
<div class="square-four"></div>
<div class="square-five"></div>
<div class="square-six"></div>
<div class="container-three"></div>
</div>
</body>
CSS
.container {
width: 100%;
display: inline-block;
float: left;
}
.square-one {
float: left;
width: 25%;
height: 200px;
background-color: #fff;
display: inline-block;
margin: 0;
padding: 0;
}
.square-two {
float: left;
width: 75%;
height: 200px;
background-color: #63D6C3;
display: inline-block;
margin: 0;
padding: 0;
}
.square-three {
float: left;
width: 25%;
height: 200px;
background-color: #F86060;
display: inline-block;
margin: 0;
padding: 0;
}
.square-four {
float: left;
width: 25%;
height: 200px;
background-color: #ffffff;
display: inline-block;
margin: 0;
padding: 0;
}
.square-five {
float: left;
width: 50%;
height: 400px;
background-color: #FBFAED;
display: inline-block;
margin: 0;
padding: 0;
}
.square-six {
float: left;
width: 50%;
height: 400px;
background-color: #061D33;
display: inline-block;
margin: 0;
padding: 0;
}
愛的顏色。你似乎需要的是一個類似於砌體插件創建的佈局。如果不使用JavaScript,您可能無法實現此目的。 –