我們常常需要把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;
}
簡單,但卻是最完美的解決方案。