/* 双伪元素法 */ /* before解决外边距塌陷问题 */ .clearfix::before, .clearfix::after{ content:""; display: table; } /* after清除浮动 */ .clearfix::after{ clear:both; }