我遇到了一个问题,当viewport缩小到某些元素指定的大小以下时,背景颜色的行为出现异常。尽管滚动条显示正常,但背景不是我期望的。当viewport的大小等于或大于所需大小时,背景会按预期行为。使用Firebug检查页面元素时,似乎`body`元素没有被拉伸,即使它内部的内容有被拉伸。是什么导致背景表现出这种行为?
我提供了我认为相关的HTML和CSS,但如果我漏掉了什么,请告诉我。
缩小Viewport示例: 放大Viewport示例: CSS:
我提供了我认为相关的HTML和CSS,但如果我漏掉了什么,请告诉我。
缩小Viewport示例: 放大Viewport示例: 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>