给class="div1"的div设置一个高度,然后:overflow-y: auto;

解决方案 »

  1.   


    不设置宽度能不能判断div 里面的内容超出 浏览器的底部的时候 div出现滚动条而不是浏览器出现滚动条
      

  2.   

    不设置宽度能不能判断div 里面的内容超出 浏览器的底部的时候 div出现滚动条而不是浏览器出现滚动条
      

  3.   

    不知道你的具體需求,只能猜一下,希望對你有幫助
    <!DOCTYPE HTML>
    <head>
    <meta charset="GBK" >
    <title>title</title>
    <style type="text/css">
    *{padding:0;margin:0;}
    html,body{height:100%;}
    .header{width:100%;height:100px;position:absolute;left:0;top:0;z-index:3;background:#0f0;}
    .sidebar{width:120px;height:100%;position:absolute;left:0;top:0;z-index:2;background:#f00;}
    .sidebar .inner{padding-top:100px;}
    .bodyer{width:100%;height:100%;overflow:hidden;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;padding:100px 0 0 120px;position:absolute;left:0;top:0;z-index:1;background:#0ff;}
    .bodyer .inner{width:100%;height:100%;overflow:auto;}
    </style>
    </head>
    <body>
    <div class="header">
    header
    </div>
    <div class="sidebar">
    <div class="inner">sidebar</div>
    </div>
    <div class="bodyer">
    <div class="inner">
    <div style="width:200px;height:1200px;">content</div>
    </div>
    </div>
    </body>
    </html>