今天這個案例,我們希望footer一直在頁面底部,來看看解決方案吧
CSS
復制代碼代碼如下:
Html, body, #sticker {height: 100%;}
body > #sticker {height: auto; min-height: 100%;}
#stickerCon {padding-bottom: 40px;}
#footer {margin-top:-40px; height: 40px; width: 100%; text-align: center; line-height: 40px; color: #ABA498; font-size: 12px; background: #fafafa; border-top:1px solid #E7E7E7;}
Html
復制代碼代碼如下:
<div id="sticker">
<div id="stickerCon"></div>
</div>
<div id="footer">footer</div>