作者xiongmao (休息)
看板Web_Design
標題[問題] 用了background-repeat但是背景沒重複
時間Tue Aug 8 18:30:46 2006
各位大大好,
我現在修改網頁的CSS背景遇到background-repeat沒反應的問題。
目的:
我希望把中間的div的背景設為centerbackground.jpg(7px高的白底綠框),
然後希望這個背景重複填滿整個中間的div,一直到最下面的footer,如下:
http://blog60.fc2.com/x/xiongmaolai/file/desiredbackground.jpg
問題:
(1)當我用background-repeat: repeat-y,背景沒有重複,且還不見掉,
只看得到最底的綠色背景,如下:
http://blog60.fc2.com/x/xiongmaolai/file/backgroundrepeat.jpg
(2)當我不用background-repeat,假設改用定義height:400px,
背景的白底綠框會一直延伸到400px。
樣式:
http://blog60.fc2.com/x/xiongmaolai/file/defineheight.jpg
可是由於我無法確定整個高度為多少(依文章長度),所以不是解決的方法。
請問我的background-repeat到底哪裡設錯了? 為什麼背景會不見掉?
請大家幫忙解惑,謝謝。
=============================================================================
(1)background-repeat
#outer {
position: relative;
margin: 0 auto;
padding: 0px;
width: 780px;
background:
url(
http://blog60.fc2.com/x/xiongmaolai/file/centerbackground.jpg);
background-repeat: repeat-y;
}
(2)定義height
#outer {
position: relative;
margin: 0 auto;
padding: 0px;
width: 780px;
height: 400px;
background:
url(
http://blog60.fc2.com/x/xiongmaolai/file/centerbackground.jpg);
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.189.178.212
※ 編輯: xiongmao 來自: 59.189.178.212 (08/08 18:31)
1F:→ elan:那跟background-repeat沒關係 是因你內容區塊都用絕對定位 08/08 22:45
2F:→ elan:所以你#outer高度永遠是0 08/08 23:01
3F:→ xiongmao:真的耶!問題解決了,非常謝謝你。 08/09 13:08