即使进行垂直滚动,如何将绝对定位的项目保持在网站底部? [英] How to keep an absolute positioned item at the bottom of the site even if there is vertical scrolling?

查看:58
本文介绍了即使进行垂直滚动,如何将绝对定位的项目保持在网站底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个位置绝对的页脚:

I have a footer that has position absolute:

#footer {
    position:absolute;
    bottom:0;
    height: 43px;
    padding:0;
    background-color: #333333;
    width:100%;
    color:#737373;
    text-align:center;
}

我注意到,如果我进行垂直滚动,则页脚将完全位于

I've noticed that if I do vertical scrolling the footer stays exactly in the same place (it doesn't scroll along).

有任何建议解决此问题吗?

Any suggestions to fix this?

推荐答案

此小提琴中,如果您向下挤压窗口,则页脚应覆盖文本,您会看到它固定在页面底部。它使用位置:固定;

In this fiddle, if you squish the window down so the footer should overlay the text, you'll see it stays fixed to the bottom of the page. It uses position: fixed;

这篇关于即使进行垂直滚动,如何将绝对定位的项目保持在网站底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆