2012-02-26 63 views

回答

1

您的margin-bottom: 200px规则只会影响文档流中的后续元素。它将而不是使您的div比浏览器窗口小200px。为了演示我已经设置了jsFiddle here

如果您希望div的底部距浏览器窗口底部200px,那么您可以绝对使用top: 0bottom: 200px来定位它。 JsFiddle here

+0

我已经将上述内容应用于[您的jsFiddle](http://jsfiddle.net/5ft4P/)。 – magicalex 2012-02-26 14:49:05

1

试试这个在您的主要DIV:

#content { position: absolute; top: 0; left: 0; right: 0; bottom: 200px; } 

和页脚:

#footer { position: absolute; bottom: 0; height: 200px; } 

这很可能与岗位工作:相对为好。

编辑:

这里有一个演示:http://jsfiddle.net/adaz/nQVPm/

我敢肯定,这适用于IE7 +