div 三列同高

来源:互联网 发布:java mina 编辑:程序博客网 时间:2024/05/01 13:49
<!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>div 多列同高 背景同高</title>  
  <style type="text/css">  
   
  .box {width:600px;overflow:hidden;}   //这里box的width要大于三列总的width,否则不能实现
  .box div {float:left;padding-bottom:6000px;margin-bottom:-6000px;}   //padding-bottom和margin-bottom正负值,数字要大,但最小的值是多少和什么有关系目前还没搞清楚
  .p1 {background:#5ebcf2;width:200px;}   
  .p2 {background:#d6ff96;width:200px;}   
  .p3 {background:#8cddc0;width:200px;}   
  </style>  
  </head>  
  <body>  
  <div class="box">  
    <div class="p1">  
        测试等高<br />  
        测试等高<br />  
        测试等高<br />  
        测试等高<br />  
        测试等高<br />  
        测试等高<br />  
        测试等高<br />  
        测试等高<br />  
        测试等高<br />  
        测试等高<br />  
    </div>  
    <div class="p2">  
        测试等高<br />  
        测试等高<br />  
        测试等高<br />  
    </div>  
    <div class="p3">  
        测试等高<br />  
        测试等高<br />  
    </div>  
  </div>  
  </body>  
  </html>
原创粉丝点击