【发布时间】:2021-05-30 01:58:19
【问题描述】:
说明:
我想使用以下 css 将我的网站构建成几个页面:
.page {
height: 100vh;
}
我在网站上添加了几个页面,在最后一个页面上,我希望页脚出现在页面底部,例如
.page {
height: 100vh;
background-color: cyan;
}
footer {
position: relative;
width: 100%;
height: 100px;
bottom: 0;
background-color: #000;
}
<div class="page">Page 1</div>
<div class="page">Page 2</div>
<div class="page">
<footer></footer>
</div>
我的尝试:
- 我尝试设置 position: absolute (of footer) 就像这个答案:css - footer doesn't go at bottom
- 我还尝试在页脚周围放置一个包装器,高度为:100%;
- 我还使用了 min-height: 100vh 而不是没有效果的 height
问题:
如何将页脚置于页面底部?
PS:我不知道这是否相关,但我使用的是 Firefox v. 85.0.2(64 位)
编辑:
我希望页脚在页面内,我使用这些页面来构建我的网站,并且页脚应该出现在最后一页的底部。
【问题讨论】: