边距底部不起作用?

发布于 2024-11-06 00:33:52 字数 686 浏览 0 评论 0原文

由于某种原因,我无法在页面底部添加一些填充。我有一个内容框,它到达页面末尾并到达底部,看起来不太好。我想在页面底部留出一些空间来解决这个问题,但似乎 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/

I am having trouble for some reason with getting the bottom of my page to have some padding. I have a content box that goes to the end of the page and hits the bottom and doesn't look the greatest. I want to give some space from the bottom of the page to fix this issue, but it seems that margin-bottom isn't working as I expect it to? I have included the following code which should be everything that affects the content box. I have tried removing the margin:0 in the html/body (even though I kind of need that), but that doesn't seem to work either? I feel like I am missing something really obvious.

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;}

Any help would be greatly appreciated :) Thanks!

Live link - http://quintinmarcus.com/portfolio/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野稚 2024-11-13 00:33:52

由于 content 具有 position:absolute,因此它的后边距不执行任何操作,也不应拉伸正文的内部高度,以便正文的 padding-bottom 执行任何操作。

Since content has position: absolute, its after margins do nothing, nor should it stretch the inner height of the body so that the body's padding-bottom does anything.

紫竹語嫣☆ 2024-11-13 00:33:52

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

CSS:

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

这还将使您能够在所需的底部留出边距。

If you want to centre your layout, modify your current style for #content to the following:

CSS:

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

This will also enable you to give the margin at the bottom you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文