我有一些代码:背景的顶部和底部
<body>
<div id="container">
<div id="top"></div>
<div id="bottom"></div>
</div>
</body>
集装箱宽度,例如900px。 在#top我使用body设置背景。
但是我不能在#bottom中使用背景,因为当它会变得更宽时,例如1080px(只会在#container中看到背景),它会崩溃。这个怎么做?
EDIT1:
body
{
background-image: url("images/bg_main.png");
background-repeat:repeat-x;
}
#top
{
background-image: url("images/top_bg.png");
height:50px;
}
#container
{
margin: 0;
width: 1024px;
background:#fff;
}
#footer
{
background-image:url("images/bottom.png")
}
但它创建内部容器(我需要创建底部BG外容器,当网站家业更宽)
EDIT2:
我认为,我发现了一个解决方案: html{;background-image:url('images/bottom.png');background-repeat:repeat-x;background-position:left bottom;}
,然后将div高度设置为bottom.png
你可以发布一些更多的代码吗?用你现在的小片段,我不知道该说什么。例如,“在#top我使用body设置背景”是什么? – 2012-02-24 12:11:36
我很不清楚你想要达到的目标......你可以尝试用更多的信息来延伸你的问题吗? – NDM 2012-02-24 12:12:17
听起来像他遇到的问题是#bottom div中的背景图像被裁剪,因为它被限制在与容器div(900px而不是1080px)相同的宽度。最简单的解决方案是简单地将#container的宽度扩大到1080px,有没有理由不能这样做? – DNJohnson 2012-02-24 12:16:03