日期:2013-06-27  浏览次数:21071 次

特点:不需求另外加个清除DIV.

:after(伪对象)--设置在对象后发生的内容,通常和content配合使用,IE不支持此伪对象,非Ie 浏览器支持,所以并不影响到IE/WIN浏览器。
CSS

.wrapfix:after {    content: ".";     display: block;    height: 0;     clear: both;     visibility: hidden;} 

设display:block;使用到:after 元素,由于display的默认值是"inline", 不能收到clear的特性,同时将清除容器的高度设为零,height:0;,可见度为隐藏.这是没有清除过浮动的.非Ie 浏览器看不到wrap的背景和边框.

运转代码框

  [Ctrl+A 全部选择 提示:你可先修正部分代码,再按运转]

这是清除过浮动的.非Ie 浏览器看到wrap的背景和边框.

运转代码框