实现<div>高度最大化的纯css方案

<html>
<head>
<style type="text/css">
html, body {
    height: 100%;
    margin: 0px;
}

/* this is the big trick*/
#wrapper:before {
    content:'';
    float: left;
    height: 100%;
}
#wrapper {
    height: 100%;
    background-color: black;
    color: white;
}
#header {
    background-color:#000;
}
#content {
    background-color: grey;
}
/* this is the big trick*/
#content:after {
    content:'';
    display: block;
    clear: both;
}
</style>
</head>
<body>
<div id="wrapper">
    <div id="header">
        Title here    
    </div>
    <div id="content">Some content</div>
</div>
</body>
</html>

转自: 

Set div to fill in the rest of the height dynamically?

posted @ 2014-10-19 21:49  麦仲肥  阅读(1343)  评论(0编辑  收藏  举报