這段代碼是怎么清除浮動(dòng)的 看不懂
.clearfix::before,
.clearfix::after {
? ?content: ".";
? ?display: block;
? ?height: 0;
? ?visibility: hidden;
}
.clearfix:after {clear: both;}
.clearfix {zoom: 1;}
.clearfix::before,
.clearfix::after {
? ?content: ".";
? ?display: block;
? ?height: 0;
? ?visibility: hidden;
}
.clearfix:after {clear: both;}
.clearfix {zoom: 1;}
2017-12-05
舉報(bào)
2018-06-09
其實(shí)要想清楚.clearfix的浮動(dòng),就寫下面的代碼就足夠了
.clearfix::after {
? ?content: ""; ?//可以是空串,但不能不寫
? ?display: block; //只有作為塊級(jí)元素才能清除浮動(dòng)
?? clear:both; //清除左浮動(dòng)和右浮動(dòng),只清除左浮動(dòng)就寫clear:left,右同理
}
2017-12-14
?display: block;