【发布时间】:2021-05-22 20:02:52
【问题描述】:
我正在尝试设计一个应该位于页面底部的简单页脚。换句话说,如果页面很长,用户需要向下滚动才能看到它。不知何故,页脚拒绝停留在那里,而是始终在浏览器窗口的底部可见。我认为只有将其位置设置为固定而不是绝对时才会发生这种情况。我是 Rails 新手,最重要的是,bootstrap 默认安装在项目中。认为这不会是一个问题,因为我不使用默认的页脚类。任何想法为什么会发生这种情况?
在 _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>
【问题讨论】: