在HTML:
<div class="container">
<div class="box">
<div class="box-content">
First
</div>
</div>
<div class="box">
<div class="box-content">
SECOND
</div>
</div>
<div class="box last">
<div class="box-content">
Last
</div>
</div>
</div>
在CSS中:
.container {
background: green;
overflow: auto;
}
.box {
width: 33.3%;
float: left;
}
.box.last {
width: 33.4%;
}
.box .box-content {
margin-right: 10px;
background: red;
}
.box.last .box-content {
margin-right: 0px;
background: red;
}
,如果你想你的盒子具有相同的高度 在CSS中添加:
.box .box-content {
margin-right: 10px;
background: red;
margin-bottom: -1000px;
padding-bottom: 1000px;
}
http://jsfiddle.net/wqwDN/
感謝,這麼明顯,現在我看到它 – 2012-07-18 11:29:43
很好的解決方案,謝謝! – 2015-05-26 15:11:33