<!DOCTYPE html>
<html>
<head>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<title>Demo</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
html, body {
height: 100%; /* 重点 */
}
body > .wrap {
height: auto;
min-height: 100%; /* 重点 */
}
.main {
padding-bottom: 150px;
}
.header {
background: #ffc543;
height: 60px;
}
.content {
background: red;
/*height: 1000px;*/
}
.footer {
height: 100px; /* 重点 */
margin-top: -100px; /* 重点 */
background: gray;
clear: both;
}
/*.clearfix:after,
.clearfix:before {
content: "";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
*/
</style>
</head>
<body>
<div class="wrap">
<div class="main clearfix">
<div class="header">
头部
</div>
<div class="content">
主体
</div>
</div>
</div>
<div class="footer">
底部
</div>
</body>
</html>