Html清除浮动

精益求精方案一:

  相对于空标签闭合浮动的方法代码彷佛仍是有些冗余,经过查询发现Unicode字符里有一个“零宽度空格”,也就是U+200B ,这个字符自己是不可见的,因此咱们彻底能够省略掉 visibility:hidden了spa

1 .clearfix:after {content:"\200B"; display:block; height:0; clear:both; }
2 .clearfix { *zoom:1; }.

精益求精方案二:

  由 Nicolas Gallagher 大湿提出来的,原文:A new micro clearfix hack,该方法也不存在firefox中空隙的问题。firefox

1 /* For modern browsers */
2 .cf:before,.cf:after {
3 content:"";
4 display:table;
5 }
6 .cf:after { clear:both; }/* For IE 6/7 (trigger hasLayout) */
7 .cf { zoom:1; }
相关文章
相关标签/搜索
本站公众号
   欢迎关注本站公众号,获取更多信息