stick-footer
文章内容不足满屏时 footer在底部,超过满屏时footer在内容末尾。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>让footer固定在页面顶部</title>
<style>
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important; /* 如果你不需要考虑IE6,则可以把这行与下一行代码删除 */
height: 100%;
margin: 0 auto -4em;
}
.footer, .push {
height: 4em;
}
body{
text-align: center;
}
.footer{
background-color: #00BBFF;
}
</style>
</head>
<body>
<div class="wrapper">
<h3>你可以通过调整浏览器大小,查看footer的表现</h3>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<p>我是占位的</p>
<div class="push"></div>
</div>
<div class="footer">
<p>Footer</p>
</div>
</body>
</html>