This question already has an answer here:
这个问题在这里已有答案:
- How do you get the footer to stay at the bottom of a Web page? 24 answers
- Make footer stick to bottom of page correctly [duplicate] 10 answers
如何让页脚停留在网页的底部? 24个答案
使页脚正确粘贴到页面底部[复制] 10个答案
I require my footer to stick to the bottom of the page. Currently sticks to the bottom when the view port is full and doesn't extend. However when I use a smaller resolution I get a vertical scroll bar, and the footer remains where the view port was originally and doesn't stick to the bottom of the page.
我要求我的页脚粘在页面底部。当视口已满并且不延伸时,当前粘到底部。但是,当我使用较小的分辨率时,我会得到一个垂直滚动条,并且页脚仍然保留在视口最初的位置,并且不会粘在页面的底部。
Link: http://cazdesigns.net/caz/pictures.html
Any help would be appreciated. I have tried multiple techniques which only seem to work in the view port and not when vertically scrolling is involved.
任何帮助,将不胜感激。我尝试了多种技术,这些技术似乎只在视口中工作,而不是在涉及垂直滚动时。
2 个解决方案
#1
You need to use position:fixed;
add the following to your CSS:
你需要使用position:fixed;将以下内容添加到CSS中:
#footer{position:fixed;}
#2
Just merege this css code with your css:-
用你的CSS代替这个css代码: -
html { min-height:100%; float:left;}
body { min-height:100%; float:left; position:relative;}
#footer { position:absolute; bottom:0; left:0; width:100%; padding-top:25px;}
And remove Postion:relative from #gallery div...
并从#gallery div中移除Postion:relative ...
#1
You need to use position:fixed;
add the following to your CSS:
你需要使用position:fixed;将以下内容添加到CSS中:
#footer{position:fixed;}
#2
Just merege this css code with your css:-
用你的CSS代替这个css代码: -
html { min-height:100%; float:left;}
body { min-height:100%; float:left; position:relative;}
#footer { position:absolute; bottom:0; left:0; width:100%; padding-top:25px;}
And remove Postion:relative from #gallery div...
并从#gallery div中移除Postion:relative ...