页面内容比较少的时候,footer 置于底部,整体看起来或许会更好。
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html {
height: 100%;
}
body {
position: relative;
min-height: 100%;
}
.container {
padding-bottom: 50px;
}
.footer {
position: absolute;
bottom: 0;
left: 0;
height: 50px;
width: 100%;
}
</style>
</head>
<body>
<div class="header"></div>
<div class="container"></div>
<div class="footer"></div>
</body>
</html>