某个div的height占据屏幕100%

div的height要100%,上层div,html,body也要100%

<!DOCTYPE html>
<html lang="en">
<head>
    <style type="text/css">
        html,body{
        height:100%;
        margin:0;
        }
        .container{
            height:100%;
        }
        .header{/*类名*/
            height:80px;
            background:#C0C0C0;
        }
        .content{
            border:1px dotted;
            height:100%;
        }
        .left_content{
            background:#708090;
            width:15%;
            float:left;
            height:100%;
        }
        .right_content{
            background:#F5FFFA;
            width:85%;
            float:left;
            height:100%;
        }

    </style>
</head>

<body>

<div class="container"><!--container-->

    <div class="header"><!--header-->
        header
    </div><!--end header-->

    <div class="content"><!-- content-->
        <div class="left_content"><!--left content-->
        left
        </div>
        <div class="right_content"><!--right content-->
        right
        </div>
    </div><!--content-->

    <div><!--footer-->
        footer
    </div><!--end footer-->
</div><!--end container-->

</body>
</html>
View Code

 

posted @ 2016-01-30 23:36  沐风先生  阅读(343)  评论(0)    收藏  举报