css清除浮动


<ul id="demo1" class="nostyle demo clearfix"> 
 <li>1</li>
 <li>1</li>
 <li>1</li>
</ul>


// Css Code
/*简洁版*/
.clearfix:before, .clearfix:after {
	content:"";
	display:table;
}
.clearfix:after{
	clear:both;
	overflow:hidden;
}
.clearfix{
    zoom:1;
}


/* 经典版 */
.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
}
* html .clearfix             { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */


/* 简单粗暴版  overflow:auto 或者  overflow:hidden */
.clearfix{
  overflow:hidden; *zoom:1;
}


评论

发表回复