即使在滾動時,如何在瀏覽器屏幕的底部設置div逗留?使用CSS或jQuery的粘滯頁腳
-1
A
回答
3
使用position: fixed
財產的附加到該div
的CSS。
#footer {
position:fixed;
bottom:0;
}
6
假設你有以下的div
<div class="footer">This is at the bottom</div>
你可以把它貼在視口的底部與下面的CSS
.footer {
position: fixed;
bottom: 0;
}
滾動時,會呆在那裏連。
1
有這個CSS一試:
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
height: 142px; /* .push must be the same height as .footer */
}
0
0
有一個在
http://www.lwis.net/journal/2008/02/08/pure-css-sticky-footer/
演示頁面優良的頁腳教程在這裏:
http://www.lwis.net/profile/CSS/sticky-footer.html
的基本前提是,主體頁面被拉伸到100%的頁面。最小的高度也是100%。
然後頁腳給出以下規則:
#footer {
clear: both;
position: relative;
z-index: 10;
height: 3em;
margin-top: -3em;
}
我得到的答案從this
相關問題
- 1. 粘滯頁腳CSS
- 2. Css粘滯頁腳 - 響應
- 3. CSS粘滯頁腳失敗
- 4. CSS粘滯頁腳問題
- 5. 實現CSS - 粘滯頁腳
- 6. CSS粘滯頁腳問題
- 7. jquery粘滯頁腳問題
- 8. HTML/CSS - 粘滯頁腳問題
- 9. CSS粘滯頁腳 - 保證金
- 10. 用ASP.NET粘滯頁腳
- 11. 粘滯頁腳的問題
- 12. 使用jQuery只使用粘滯頁腳(sub-footer和主頁腳底部)
- 13. 手機粘滯頁腳
- 14. 粘滯頁腳在底部
- 15. IE8粘滯頁腳問題
- 16. 粘滯頁腳和動畫
- 17. 粘滯頁腳和IE
- 18. 粘滯頁腳不工作
- 19. 粘滯頁腳,或者說:內容不會延伸到頁腳
- 20. 固定頂部導航+使用jquery粘滯頁腳
- 21. CSS - 粘頁腳
- 22. 使用JQuery粘滯元素
- 23. CSS粘滯頁腳內容時不佔用
- 24. MobileAngularUI內部的粘滯頁腳部分
- 25. WordPress的粘滯頁腳二十二
- 26. 使用CSS的粘滯div位置
- 27. 粘性CSS頁腳
- 28. jQuery粘頁腳
- 29. CSS jquery滾動粘滯菜單
- 30. CSS - 粘滯頁腳+補充工具欄問題
http://www.google.com/search?q=sticky+footer+using+css –
@Pranav我看到你的谷歌搜索,並提出你一個網站搜索:http://stackoverflow.com/search?q=sticky+footer+css 759個問題。愚蠢的愚蠢。 –
[CSS,粘性頁腳]的可能重複(http://stackoverflow.com/questions/10465250/css-sticky-footer),[粘性頁腳CSS](http://stackoverflow.com/questions/5822825/sticky- footer-css)以及與這些問題相關的數十個問題。 –