我知道這是超級簡單,但不知道爲什麼我不能做到這一點。如何將3個100%寬的盒子對齊放置在每個盒子下方?
我想幹什麼?
我希望有3個盒子可以和用戶的屏幕一樣寬,並且需要將它們堆疊在一起。我也想刪除顯示在左側和右側的空白。
我試過了什麼?
<div class="box box1">
</div>
<div class="box box2">
</div>
<div class="box box3">
</div>
.box {
width: 100%;
float: left;
height: 300px;
margin-bottom: 20px;
}
.box1 {
background: red;
}
.box2 {
background: green;
}
.box3 {
background: yellow;
}
看起來很好http://jsfiddle.net/j08691/cUhfh/即使您的浮動和寬度規則似乎並沒有在一起。 – j08691
所以,只需刪除'float:left;'CSS聲明 –
謝謝@ j08691,但我也需要刪除左側和右側的空白。我怎麼做?我認爲使用浮動將完全100%。 – ariel