清除浮动三种方法 兼容IE Firefox Chrome等
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css"><!--/* 方法三 要注意兼容性 加上clearfix类 */.clearfix:after { content: ""; display: block; clear: both;}.clearfix { *zoom:1;}--></style></head><body><!--方法二 有时有副作用 set overflow hidden or auto --><div style="background:green;/*overflow:hidden;*/" class="clearfix">555<div style="background:red; width:100px; float:left;">1此处显示新 Div 标签的内容</div><div style="background:red; width:100px; float:left;">2此处显示新 Div 标签的内容</div><div style="background:red; width:100px; float:left;">3此处显示新 Div 标签的内容</div><div style="background:red; width:100px; float:left;">4此处显示新 Div 标签的内容</div><!--方法一 需要加上额外标签 --><!--<div style="clear:both;" /> --></div></body></html>
页:
[1]