1

由于某种原因,我在让页面底部有一些填充时遇到了麻烦。我有一个内容框,该框位于页面末尾并位于底部,看起来不是最好的。我想从页面底部留出一些空间来解决这个问题,但似乎 margin-bottom 没有像我预期的那样工作?我已经包含了以下代码,它应该是影响内容框的所有内容。我已经尝试删除 html/body 中的 margin:0 (尽管我有点需要),但这似乎也不起作用?我觉得我错过了一些非常明显的东西。

html, body {
margin:0;
padding:0;
width:100%;
height:100%;
text-align:left;}

#content {
position: absolute;
left: 50%;
margin-left: -368px;
top: 104px;
padding-left: 35px;
padding-right: 35px;
padding-top: 15px;
padding-bottom: 15px;
background-color: white;
border: 1px solid black;
width: 664px;
margin-bottom: 20px;}

任何帮助将不胜感激:) 谢谢!

实时链接 - http://quintinmarcus.com/portfolio/

4

2 回答 2

1

由于contenthas position: absolute,它的后边距什么都不做,也不应该拉伸身体的内部高度,以便身体的 padding-bottom 做任何事情。

于 2011-05-09T01:43:09.843 回答
0

如果要使布局居中,请将当前样式修改为#content以下内容:

CSS:

#content {
width:664px;
margin:104 auto 20px auto;
padding: 15px 35px;
background-color: white;
border: 1px solid black;
}

这也将使您能够在所需的底部提供边距。

于 2011-05-09T02:09:27.000 回答