如何去除內嵌塊元素之間的幻影空間?Chrome,Safari和Firefox中的內嵌塊元素之間的幻影空間
這裏是一個jsfiddle http://jsfiddle.net/hFDcV/在這裏你可以清楚地看到divs之間的水平空間。
而StackOverflow的授權的示例代碼:
<div id='row'>
<div class='box'>Something</div>
<div class='box'>Something</div>
<div class='box'>Something</div>
<div class='box'>Something</div>
</div>
#row {
background-color: red;
}
.box {
width: 150px;
height: 150px;
background-color: yellow;
display: inline-block;
margin: 0;
padding:0;
}
白色空間在這些元素之間進行渲染。我確信有一個乾淨的方法可以解決這個問題,但我必須做一些測試才能解決這個問題。 – Shmiddty
http://css-tricks.com/fighting-the-space-between-inline-block-elements/ –
將'float:left;'添加到'.box'類 –