当视口缩小到小于我为某些元素指定的尺寸时,我遇到了背景颜色异常的问题。虽然滚动条正确显示,但背景不是我所期望的。当视口与预期一样大或更大时,背景的行为将符合预期。使用 Firebug 检查页面元素时,即使元素内部的内容是,该元素似乎body
也没有拉伸。是什么导致背景以这种方式表现?
我已经提供了我认为相关的 html 和 CSS,但如果我遗漏了某些内容,请告诉我。
缩小视口示例
放大视口示例
CSS
html
{
background: #A37C45;
}
body
{
background:
#55688A url("../images/backgrounds/ns_bg.gif") repeat-x scroll 0 0;
}
#container
{
width: 100%;
}
#header
{
width: 730px;
margin-left: auto;
margin-right: auto;
padding: 5px;
overflow: hidden;
}
#main
{
width: 730px;
margin-top: 2px;
margin-left: auto;
margin-right: auto;
overflow: hidden;
}
#footer
{
background:
url("../images/backgrounds/grass.png") repeat-x scroll left top;
clear: both;
width: 100%;
overflow: hidden;
padding-top: 30px;
margin-top: 20px;
}
#footercontainer
{
width: 100%;
background-color: #A37C45;
margin-top: -1px;
}
#footercontent
{
width: 730px;
margin-left: auto;
margin-right: auto;
padding-bottom: 25px;
overflow: hidden;
}
HTML
<html>
<body>
<div id="container">
<div id="header">
</div>
<div id="main">
</div>
</div>
<div id="footer">
<div id="footercontainer">
<div id="footercontent">
</div>
</div>
</div>
</body>
</html>