为什么我的页脚会一直向下?

时间:2012-03-03 20:41:30

标签: css footer

网站在这里:

http://www.cottonbrewing.com/members

如果内容不需要页面滚动,那就没问题了。

CSS:

#footer {
    position:absolute;
    bottom:0;
    left:0;
    right:0;
    margin: 0 auto;
    font-size: 12px;
    font-weight: normal;
    clear:both;
    padding: 10px 0px 10px 0px;
    text-align: center;
}

编辑1:如果内容很小,我还必须确保页脚位于绝对底部,例如您在此处看到:http://www.cottonbrewing.com/页脚位于底部。

2 个答案:

答案 0 :(得分:0)

position:absolute;更改为position:relative;

<强> ADDITION

在回复评论时,请遵循以下指南以获取“粘性页脚”:

body
{
  height:100%;
}

您的容器div

#container
{
  min-height: 100%;
  position: relative;
}

您的页脚div

#footer
{
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 30px; /* can be changed, along with padding */
}

答案 1 :(得分:0)

删除底部:0; 并将位置更改为相对位置。