我有一个简单的页脚,我希望它始终位于页面底部。
目前它固定在页面底部,但当页面内容较高且需要滚动时,页脚位于代码顶部,而不是底部。
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 8vh;
background-color: #000000;
}
@media only screen and (max-width: 500px) {
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 16vh;
background-color: #000000;
}
<div class="footer">
</div>
如果指针底部没有空白,我们将不胜感激。我试过粘性,但也没有用。
提前致谢。
最佳答案
如果您希望页脚保持固定(始终可见)在页面底部,您可以提供 <body>
等于页脚高度的填充。这样,页脚后面就不会隐藏任何内容。
关于html - 页脚与媒体查询重叠的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52844459/