码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2014-10-19 22:45:56      阅读:583      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   ar   for   sp   div   

<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?

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

标签:style   blog   http   color   io   ar   for   sp   div   

原文地址:http://www.cnblogs.com/kanputer/p/4035676.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!