带有repeat-y的背景不随内容扩展

时间:2014-05-02 03:14:47

标签: html css

我需要你的帮助。我一直在StackOverflow和其他来源中搜索类似的问题。但由于某种原因,我仍然无法解决我的问题。我不确定我错过了什么,但它一定是什么东西。我有一个背景图像重复的div。但是在特定div的高度之后,背景图像不再重复了。

所以这是我的CSS

html{
    width:100%;
    background-image:url(../images/bg.gif);
    background-position:top left;
    background-repeat:repeat-x;
}
body{
    width:1000px;
    margin:0 auto;
    font-family:Arial, Helvetica, sans-serif;
    font-size:11px;
    height: 100%;
}
.content_middle_border {
    width: 859px;
    min-height: 485px;
    background: url(../images/content_middle_border.jpg) repeat-y;
    border: 1px solid yellow;
}
#content{
    width:859px;
    margin:0 auto;
    overflow: hidden;
}

我在#content div中有content_middle_border div。但是,在内容超过485px后,repeat-y的背景不会重复。提前谢谢。

1 个答案:

答案 0 :(得分:0)

由此解决

.content_middle_border {
    width: 859px;
    min-height: 485px;
    background: url(../images/content_middle_border.jpg) repeat-y;
    overflow: inherit; /*Newly added this line*/
}

所以div将继承其#content div。谢谢。