简体   繁体   English

页脚不会停留在内容的底部

[英]Footer doesn't stay at the bottom with content

When i have a few content with work well. 当我对工作有一些满意的时候。 And if i just put something like a bunch of 如果我只是放一些
it work fine as well. 它也可以正常工作。 And if i remove the content from #content, it does work too. 如果我从#content中删除内容,它也可以正常工作。 Since there`s too many code i'll be pasting ti on pastebin. 由于代码太多,我将ti粘贴到pastebin上。 On this screenshot the problem is shown: http://postimage.org/image/ee448x5yp/ the footer is the black part and the green part is the html, body as you can see on the css. 在此屏幕快照上显示了问题: http : //postimage.org/image/ee448x5yp/页脚是黑色的部分,绿色部分是html,即在CSS上可以看到的正文。 Any possible solution? 有什么解决办法吗? :( :(

HTML 的HTML

<div id="wrap">
    <div id="header">
        ...
    </div>
    <div id="content">
        <div class="center">
                ...
        </div>
    </div>
    <div id="footer">
        ...
    </div>
  </div>

CSS 的CSS

#wrap {
    width: 100%;
    min-height: 100%;
    margin: 0 auto -75px; /* the bottom margin is the negative value of the footer's   height */
    position: relative;
    text-align: left;
}

#footer {
  position: absolute;
  bottom: 0;
  height: 75px; /* Height of the footer */
  width: 100%;
  background: #000;
  text-align: center;
  line-height: 103px;
}

WHOLE SITUATION FIDDLE 整个情况

http://jsfiddle.net/Vmvrd/ http://jsfiddle.net/Vmvrd/

我认为它工作正常,请看一个小提琴示例,该示例已添加到您的编辑帖子中。

There are elements in your footer that are taller than it. 页脚中有些元素比它高。 They expand the body , but not the footer, since the footer's height is fixed. 由于页脚的高度是固定的,因此它们会扩展body ,但不会扩展页脚。 Add overflow: hidden to your #footer , and work from there. 添加overflow: hidden在您的#footer ,然后从那里开始工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM