html - 页脚与媒体查询重叠的内容

标签 html css

我有一个简单的页脚,我希望它始终位于页面底部。

目前它固定在页面底部,但当页面内容较高且需要滚动时,页脚位于代码顶部,而不是底部。

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

相关文章:

html - 使用 css/html 的鼠标悬停(黑色+按钮+放大)

html - jQuery 卷 UI 与我推出的不同?

Html table<td> - 当表格宽度为 100% 时如何滚动 TD 宽度?

javascript - .not() 函数 jquery 隐藏其他元素

javascript - 带图标的 Bootstrap 复选按钮不起作用

css - Bootstrap 4 边框重叠按钮元素

html - 为什么发送邮件时不在另一个div的底部添加一个div?

javascript - 覆盖层可通过在外部单击关闭

javascript - 如何按顺序检索特定 DOM 元素的所有 index() 值

JavaFX 无法删除选项卡顶部的空间