作者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