3

最初我有一个显示为渐变背景的背景图像。想要拥有纯黑色背景,我删除了指向背景图像/重复 x 的链接。结果是页面底部有一个大的空白区域。我已经搜索了很多这个常见问题的答案,但没有一个能帮助我解决这个问题。

这是一个 .php 站点,所以如果有一个 html .div 则我找不到它,但在 css 样式表中它只是读作 #top-bg with background: #000000

我试过增加 height: 100%; 不知道在哪里调整某些网站推荐的边距。任何帮助将不胜感激!

4

4 回答 4

4
body, html{
    padding:0!important; 
    margin:0 !important;

    background:#000;//is this what you want?
}
于 2012-08-08T09:30:10.387 回答
0

尝试这个

body, html {

background:#000;
height:100%;
padding:0;
margin:0


}
于 2012-08-08T13:22:33.113 回答
0

首先,您是否认为删除默认浏览器填充和边距?

html{
    margin: 0;
    padding: 0;
}

另外,在哪里定义你的背景?

  • 在你的第一个 div 中?
  • 在你的身体里?
  • 在你的 HTML 中?

为了更好,背景是在你的身体标签中定义的:

body{
    background-color: #FCC; /* for test */
}

如果您没有填充,没有边距,此代码为您工作......

于 2012-08-08T09:36:15.420 回答
0
html {
  background:#000;
}

这足以让我删除空白。

于 2020-04-29T10:06:27.123 回答