给父元素添加这个类就能解决父元素没有高度的问题,
.clearfix::after { clear:both; content:''; display:block; width: 0; height: 0; visibility:hidden; }