引入.clearfix這個css類,然後再相應的父标簽中用class導入;
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {display: inline-block;}
* html .clearfix {height: 1%;}
.clearfix {display: block;}
改方法相容于FF、Opera和IE浏覽器
轉載于:https://www.cnblogs.com/huashengjam/archive/2009/07/21/1527698.html