+ -
当前位置:首页 → 问答吧 → 3个DIV 怎么浮动

3个DIV 怎么浮动

时间:2010-09-16

来源:互联网

1.jpg (10.43 KB)
2010-9-16 15:22


用3个DIV怎么浮动

作者: millionfor   发布时间: 2010-09-16

上面一组用的定位,下面一组用的浮动
<!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"> * {margin:0;padding:0;} .wrap {width:610px;margin:10px auto;position:relative;} #box1 {width:300px;height:200px;background:#ffc;margin-bottom:10px} #box2 {width:300px;height:300px;background:#fcc} #box3 {width:300px;height:510px;background:#cff;position:absolute;top:0;right:0} #box4 {float:left;width:300px;height:200px;background:#cfc;margin-bottom:10px} #box5 {float:left;width:300px;height:300px;background:#acc} #box6 {float:right;width:300px;height:510px;background:#ccf;} </style> </head> <body> <div class="wrap"> <div id="box1"></div> <div id="box2"></div> <div id="box3"></div> </div> <div class="wrap"> <div id="box4"></div> <div id="box6"></div> <div id="box5"></div> </div> </body> </html>
 提示:您可以先修改部分代码再运行

作者: geminids   发布时间: 2010-09-16

谢谢le   我一直用浮动 浮动 忘记定位了 呵呵

作者: millionfor   发布时间: 2010-09-16