父元素加上类clearfix,在父元素后面加上一个伪类::after .clearfix:after{ content: ''; display: block; /*或者 table*/ clear: both; }