php - CSS - 页脚留在页面底部

标签 php html css

<分区>

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

下面是我目前拥有的,虽然我已经尝试了很多不同的东西并在谷歌上搜索了很多!!

#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...

最佳答案

你应该使用position:fixed

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

关于php - CSS - 页脚留在页面底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34200945/

上一篇:javascript - jQuery 未检测到 div 调整大小

下一篇:javascript - 隐藏具有不影响性能的特定 ID 的元素的最佳方法是什么

相关文章:

php - yii - 为按日期排序的每个类型字段选择前五个记录

php - AJAX 悬停工具提示仅显示表中第一行的返回数据

javascript - 选择 tr 及其 "tr childs"- 查找 jquery 选择器

internet-explorer-7 - 当嵌入父容器中并溢出 :auto set 时,JQueryUI Accordion 在 IE7 中损坏

html - 为什么 Select 元素之间有一个神秘的边距?

php - __set() 方法回显属性值两次

php - 使用 POST 更新 mysql 表

PHP 脚本创建了一个包含 "О╩©"奇怪字符的不可预见的输出

javascript - 当我使用 lineTo 和 moveTo 绘制桨时,如何使用 Javascript 在 Breakout 中移动桨?

CSS左侧菜单布局问题