清除浮动的较完美方法:不添加无意义标签
引入.clearfix这个css类,然后再相应的父标签中用class导入;
改方法兼容于FF、Opera和IE浏览器
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {display: inline-block;} /* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;} /* End hide from IE-mac */
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {display: inline-block;} /* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;} /* End hide from IE-mac */
改方法兼容于FF、Opera和IE浏览器