我们常常需要把footer放置在页面的最低端,那么如果页面的内容高度不够,footer并不会自动置于底端。我们需要进行自定义CSS:
html {
min-height: 100%; /* 非常重要 */
position: relative;
}
body {
/* Margin bottom by footer height */
margin-bottom: 80px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 80px;
}
简单,但却是最完美的解决方案。