0

I have strange problem. I've a two column DIV layout and I'm setting the page's background via an background-image for the body element.

But my body-element isn't as height as my visible content. I think the problem are absolute positioned div container which grow more than the rest of the page.

How can I fix that?

4

6 回答 6

2

给出的信息很少,让我建议提高你的身体:

body { height:100%; }

根据您的设计,这可能有效,也可能无效。

于 2012-04-24T10:48:56.807 回答
0

尝试包括

 body
 {
  height: 100%;
 }

在你的 css 文件中。

于 2012-04-24T10:49:34.363 回答
0

像这样写:

html, body {
    height:100%;
}
于 2012-04-24T10:50:23.940 回答
0

如果没有代码或示例,我的建议是为您的浏览器添加一个不错的 CSS 重置。默认情况下,浏览器有一个 CSS “电子表格”,通常正文有边距。

试试这个

于 2012-04-24T10:50:51.757 回答
0

在您的 CSS 文件中,您可以使用:

html{
    background: url(../images/image.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

这会将背景图像的大小调整为所有显示器。

于 2012-04-24T10:53:40.233 回答
0

抱歉,我不能发布解决方案的代码,因为我必须发布整个 HTML 文件,这个文件非常大。

问题似乎是我正在处理的那种页面:它只是一个分为多个部分的 HTML 站点。但是每个部分在经典网页设计中都是一整页。用户使用 JS 在各个部分之间切换。

删除 position: relative 从增长的内容 div 后,使部分高度 100%,死增长的内容 div 高度 100% 似乎工作。

但是仍然奇怪的是,为什么该部分没有像具有动态大小内容的 div 那样增长。

于 2012-04-24T11:34:49.053 回答