我有一些代碼:背景的頂部和底部
<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