您的位置:首页 > Web前端 > CSS

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

2014-10-19 21:49 211 查看
<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?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: