页脚不是“总是”粘在底部

时间:2013-08-06 09:13:32

标签: html css footer zen

我正在处理的这个网页的页脚在大多数页面上都是贴在底部,除非内容大于“应该是”的内容。

错误的页面是:* 一个好的页面是:*

我尝试了多种将页脚粘贴在底部的方法,但都有不同的结果。

这是Drupal 7.x的Zen starterkit模板。

1 个答案:

答案 0 :(得分:2)

问题不在于页脚。你有这个CSS强制#wrapper#subwrapper元素的高度为1100px,这就是为什么它似乎有一些“低于”页脚的东西。

#wrapper{
  position: absolute;
  left: 0px;
  top: 240px;
  width: 100%;
  height: 1100px; /* This is making the page longer than it should be.*/
  background: #85bb99;
  z-index: -5;
}

#wrapper #subwrapper {
  background: url('/themeimages/pattern-cutout.png');
  opacity: 0.2;
  width: 100%;
  height: 1100px; /* Same thing here */
}

看起来您正在将这些元素用作背景图像。您可以通过尝试使用此CSS来修复它:

#wrapper{
  position: fixed; /* Use fixed positioning so it'll always be displayed */
  left: 0px;
  width: 100%;
  height: 100%; /* Set a height of 100% */
  background: #85bb99;
  z-index: -5;
}

#wrapper #subwrapper {
  background: url('/themeimages/pattern-cutout.png');
  opacity: 0.2;
  width: 100%;
  height: 100%; /* Set a height of 100% */
}