1

在我的网站中,我有一个高度为 100px 的页脚,页脚的 css 如下所示:

.footnote {
  width: 95%;
  height: 100px;

  position: fixed;
  background: url('../images/coolfooter.png') bottom center;

  bottom: 40px;
  left: 30px;
 }

问题是如果我的网页上有太多内容,内容就会开始与页脚重叠。

在此处输入图像描述

我想将内容限制为始终以某种方式仅出现在页脚上方,以免内容与页脚重叠。如何才能做到这一点?

4

3 回答 3

1

你试过z-index吗?正如其他人所说,不看 html 就很难说。我不是 100% 确定你要的是什么。

于 2012-08-15T06:19:48.273 回答
0

您基本上需要确保内容的底部边距大于或等于页脚的高度,或者(如果内容位于某种容器中)它的容器的底部填充等于或大于页脚的高度。

这是一个相当流行的参考站点,用于执行所谓的“粘性页脚”:http ://www.cssstickyfooter.com/

于 2012-08-15T06:17:04.453 回答
0

添加overflow:autodiv.content应该足够了。

<html>
<head>
  <style type="text/css">
    div.header
    {
      top:0px;
      height:100px;
      max-height:120px;
      min-height:100px;
    }
    div.content
    {
      height:600px;
      max-height:750px;
      overflow:auto;
    }
    div.footer
    {
      height:100px;
      max-height:120px;
      min-height:100px;
      clear:both;
    }
  </style>
</head>
  <body>
    <div class="header"></div
    <div class="content"></div>
    <div class="footer"></div>
  </body>
</html>
于 2012-08-15T06:24:21.247 回答