如何使页脚与内容保持一致?

时间:2011-07-06 09:09:48

标签: html css

On this site,你会看到页脚卡在左边。这是CSS:

#footer {
width: 800px;
clear:both;
float:right;
position:relative;
left:-50%;}

请让我知道为什么会这样。

谢谢,

塔拉

3 个答案:

答案 0 :(得分:2)

你应该保持简单并使用:

#footer {
    width: 800px;
    clear: both;
    margin: 0 auto; /* center it */
}

这与您在.container上已成功使用的技术完全相同。

答案 1 :(得分:0)

将页脚居中:

#footer {
  width:800px;
  position:absolute;
  padding-left:50%;
  margin-left:-400px;
  bottom:0px;
}

答案 2 :(得分:0)

#footer {
    position:absolute;
    bottom:0px;
    width:100%;
}

示例演示:http://jsbin.com/ecolun/3