但使用後最常碰到的問題是在inline-block的元素之間會有個「4px」的空白間距。
處理方法很簡單,目前最通用的方法是在inline-block的父元素上加上font-size: 0,然後在inline-block元素加上原本要顯示的font-size例如font-size: 16px。
SASS:
.clearfix
&:before
content: ""
display: table
&:after
content: ""
display: table
clear: both
zoom: 1
CSS:
.clearfix, {
zoom: 1;
}
.clearfix:before {
content: "";
display: table;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}