简体   繁体   English

容器背景重复-不起作用

[英]container background repeat-y not working

Have the following html code: 具有以下html代码:

<div id="container">
    <div id="container2">
            ...
    </div>
</div>

and the following css: 和以下css:

#container {
background: #323232 url(../images/container-bg.png) repeat-y;
position: relative;
min-height: 75%;
}

#container2 {
background: url(../images/container-bg-right.png) repeat-y right top;
}

but the image in #container2 is not repeating itself vertically after I added 'min-height: 75%' to #container. 但是我在#container中添加了“最低高度:75%”后,#container2中的图像未垂直重复。

Any advise is appreciated! 任何建议表示赞赏!

So I figured it out, here is what I did: 所以我想通了,这是我所做的:

#container {
    background: #323232 url(../images/container-bg.png) repeat-y;
    position: relative;
    height: 75%;
}

#container2 {
    background: url(../images/container-bg-right.png) repeat-y right top;
    min-height: 100%;
}

Thanks! 谢谢!

I believe that your container2 background is not repeating because it has no height. 我相信您的container2背景不会重复,因为它没有高度。 So if you want it to repeat as much as container one just give it the same min-height as container1. 因此,如果您希望它重复与容器1一样多的大小,只需为其设置与容器1相同的最小高度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM