父元素加上类clearfix,在父元素后面加上一个伪类::after

    1. .clearfix:after{
    2. content: '';
    3. display: block; /*或者 table*/
    4. clear: both;
    5. }