头部内容1000px
Left 252px 高度自适应
Right 748px 高度自适应
尾巴内容1000pxDiv+css代码怎么写?新手分不高,就这点全出了!

解决方案 »

  1.   

    一般来说div的高度自适应写成style="height:auto"或者什么都不写,都可以做到
    但是,div又比较复杂,因为嵌套的多了,外层不一定跟内层高度一致所以没有非常好的方法,能做的就是上面那两种或者通过js动态控制
      

  2.   


    height:auto!important;height:360px;min-height:360px;
      

  3.   

    CSS code
    height:auto!important;height:360px;min-height:360px;
      

  4.   

    下面是根据你给出的数据写的一个html页面,代码如下:<!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>
    <style type="text/css">
    <!--
    .box {
    width: 1000px;
    }
    .head {
    width: 100%;
    background-color: #CCCCCC;
    }
    .main{
    }
    .left {
    float: left;
    width: 252px;
    height: auto;
    background-color: #0099FF;
    }
    .right {
    float: right;
    width: 748px;
    height: auto;
    background-color: #339999;
    }
    .bottom {
    width: 100%;
    background-color: #666666;
    }
    -->
    </style>
    </head><body>
    <div class="box">
    <div class="head">头部</div>
     <div class="main">
      <div class="left">
    左边
    左边
    左边
    左边
    左边
    左边
    左边
    左边
    左边
    左边
    左边
    左边
    左边
    左边
    </div>
    <div class="right">
    右边
    右边
    右边
    右边
    </div>
     </div>
     <div class="bottom">尾部</div>
     </div>
    </body>
    </html>不知道这个代码能否满足你的要求?
    left、right的高度可以根据你的内容自适应。
    当然,head、bottom部分高度可以自行调整。
      

  5.   

    [color=#339966].box {}[/color]-->上面红色部分代码为误笔。可删除。