【问题标题】:Footer Overlapping Content When Resizing调整大小时页脚重叠内容
【发布时间】:2014-04-24 19:56:45
【问题描述】:

我创建了一个粘性页脚,它似乎停留在页面底部。唯一的问题是,当我通过向上拖动浏览器底部来最小化浏览器时,上面的内容与页脚重叠。内容 div 包含在我最小化时位于页脚顶部的图像。页脚中的类型也出现在图像上方(最小化时)。任何帮助,将不胜感激。谢谢。

<div class="supercontainer"

    <div class="nav"></div>

    <div class="wrapper">

    <div class="content"></div>
    <div class="push"></div>

    </div>

    </div>

    <div class="footer"></div>

.supercontainer {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -4em;
  position: relative;
  }

.footer {
   background-color: black;
   width: 100%;
   height: 100px;
 }
  .push {
  height: 100px;
}

【问题讨论】:

标签: html css footer


【解决方案1】:

要让内容下推页脚,您需要给内容 div 一个与页脚高度匹配的负下边距。

.supercontainer {
   min-height: 100%;
   height: auto !important;
   height: 100%;
   margin: 0 auto -100px;
   position: relative;
  }

.footer {
   background-color: black;
   width: 100%;
   height: 100px;
 }

http://css-tricks.com/snippets/css/sticky-footer/

【讨论】:

  • 您好科林,感谢您的回复。可能我帖子里没说清楚。我试图让我的页脚像在哈希姆的例子中一样工作。我想我可能已经弄清楚问题出在哪里了……我将内容 div 设置为 100vh,由于某种原因导致重叠?
猜你喜欢
  • 1970-01-01
  • 2013-03-01
  • 2016-03-23
  • 1970-01-01
  • 2014-01-28
  • 2017-01-12
  • 2012-12-21
  • 1970-01-01
  • 2015-05-09
相关资源
最近更新 更多