html - 即使位置设置为绝对,页脚也保持固定
问题描述
我正在尝试设计一个应该位于页面底部的简单页脚。换句话说,如果页面很长,用户需要向下滚动才能看到它。不知何故,页脚拒绝停留在那里,而是始终在浏览器窗口的底部可见。我认为只有将其位置设置为固定而不是绝对时才会发生这种情况。我是 Rails 新手,最重要的是,默认情况下会在项目中安装引导程序。认为这不会是一个问题,因为我不使用默认的页脚类。任何想法为什么会这样?
在 _footer.scss 中:
.footer-artcollabs {
background-color: $grey-light-med;
height: 72px;
position: absolute;
bottom: 0;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
p {
margin: 0 30px 4px 30px;
}
}
.foot-logo-container {
margin-left: 30px;
width: 44px;
height: 42px;
}
在 _footer.html.erb 中:
<div class="footer-artcollabs">
<div class="foot-logo-container">
<%= render 'shared/logo' %>
</div>
</div>
解决方案
推荐阅读
- swiftui - 如何在 SwiftUI 中隐藏额外的 NavigationBar
- javascript - 从 Expo/RN 中的资产获取文件系统 URI
- jenkins - 在 Jenkins 自由式作业中,如何设置变量并在“条件步骤(单个)”步骤中使用它?
- javascript - 添加属性时如何使 JSON 文件自行更新
- javascript - React中屏幕尺寸<875px时如何(仅)删除父元素?
- javascript - Firestore 通过查询基于时间的数据接收新数据
- r - 在同一 y 轴上加入 2 个 ggplots?(滴定曲线)
- powershell - 如何调用特定的列值对象并存储到另一个 psobject?
- r - R pivot_wider 或 dcast 投射多列
- html - 为什么 img 同时 srcset 和 src 下载 2 个图像?