CSS - 页脚留在页面底部

时间:2015-12-10 11:39:09

标签: php html css

我的页面中有一个页脚,虽然它位于底部 - 它停留在屏幕的底部然后固定在那里,所以如果我向下滚动它会保持在页面的一半。

下面是我目前的情况,虽然我已经尝试过很多不同的东西并在Google上搜索了很多!!

#footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
background-color: #00608F;
text-align: center;
}

页脚出现在底部开始,但滚动时 Footer appears at bottom to start with but when I scroll 它停留在同一个位置...... Its stays in the same position...

1 个答案:

答案 0 :(得分:1)

您应该使用position:fixed

#footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 1rem;
    background-color: #00608F;
    text-align: center;
    }
<footer id="footer">
  Footer
</footer>

相关问题