由于某些原因,我的html正文无法覆盖我当前处理的页面的整个高度。
我在这里没什么主意了。如果有人能看看我的代码,那将是非常棒的。
抱歉链接:(
我已经尝试过将100%的高度和最小高度应用于html和body标签,正如这里的大多数问题所建议的那样。它并没有解决问题。
提前感谢
您的问题在于div的id为"content"。它有一个相对位置和一个大的顶部值分配给它。为了更简单,这两个属性导致了问题:
#content {
/*some properties here
position: relative;
top: 199px;
}
正文仍然横跨页面高度的100%。它是相对定位的内容div,然后"推"到其正常位置下方199像素。
删除顶部属性,您的正文标签将覆盖页面的100%,即删除此属性:
top:199px;
本质上,CSS类应该看起来像:
#content {
width: 940px;
height: auto;
min-height: 400px;
background-image: url('images/maincontentbg.png');
background-repeat: repeat-y;
position: relative;
padding: 20px 10px 10px;
}
希望这能有所帮助!!!
编辑:
你的CSS文件也有这个:
body {
#content {
width: 940px;
height: auto;
min-height: 400px;
background-image: url('images/maincontentbg.png');
background-repeat: repeat-y;
position: relative;
padding: 20px 10px 10px;
top: 199px;
margin: 0;
padding: 0;
background-image: url(images/background.jpg);
background-repeat: no-repeat;
}
这完全是错误的。如果你想将CSS应用于主体和具有和id"content"的元素,那么你必须这样写CSS:
body, #content {
width: 940px;
height: auto;
min-height: 400px;
background-image: url('images/maincontentbg.png');
background-repeat: repeat-y;
position: relative;
padding: 20px 10px 10px;
top: 199px;
margin: 0;
padding: 0;
background-image: url(images/background.jpg);
background-repeat: no-repeat;
}
若要将其向下推,您可以使用保证金。像这样:
margin: 199px 0px 0px;
这将给你想要的效果!!
将此规则添加到css中。
html,正文{高度:100%;}
清理你的css。。。并保持研究