+ -
当前位置:首页 → 问答吧 → 用float:left和marginleft来排版后 margin-left那个div里再有float掉下去的问题

用float:left和marginleft来排版后 margin-left那个div里再有float掉下去的问题

时间:2011-09-02

来源:互联网

<!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=gb2312" />
<title>无标题文档</title>
</head>

<body>
<div style="float:left; background:#ccc; width:200px;height:500px;"></div>
<div style="margin-left:200px;background:#aaa;height:500px;">

<div>
<div style="float:left; background:#f00;width:100px;height:30px;">11</div>
<div style="float:left; background:#ff0;width:100px;height:30px;">11</div>
</div>
<div style="clear:both; width:400px;height:400px; background:#0f0;">
<div style="float:left;"></div>
<div></div>
</div>
</div>
</body>
</html>

作者: chenliufang   发布时间: 2011-09-02

ie6 里面 是正常的,但是标准浏览器 ie8 和ff里有问题,去掉w3c认证的 doctype 后都显示 正常 这是为什么啊 ,请高手指教啦!

作者: chenliufang   发布时间: 2011-09-02