Child Div中断Parent Div repeat-y背景

时间:2012-07-11 07:27:13

标签: html css

我目前有一个带有repeat-y背景的div元素,而子div会中断当前背景。

如何阻止这种情况发生?

      <div id="content">
     <div id="container-top"></div>
     <div id="container-body">
        <div id="container-right">
           <h1>LOGIN</h1>
           <br />
           <h1>CLICK HERE</h1>
        </div>
        <div id="container-left">
           <h1 style="padding-left: 50px; font-weight: bold; color: #000000;">NEWS</h1>
        </div>
     </div>
     <div id="container-bottom"></div>
  </div>

CSS:     #content {       向左飘浮;        保证金:5px auto;        边框:红色1px固体;     }

#container-top {
   width: 800px;
   height: 23px;
   background: url(http://cdn2.tribalwars.net/graphic/index/sprites.png) no-repeat 0 -39px;
}

#container-body {
   padding: 15px;
   overflow: visible;
   background: url(http://cdn2.tribalwars.net/graphic/index/bg-content-line.jpg) repeat-y;
}

#container-right {
   float: right;
   width: 275px;
}

#container-left {
   float: left;
   width: 440px;
}

#container-bottom {
   width: 800px;
   height: 23px;
   background: url(http://cdn2.tribalwars.net/graphic/index/sprites.png) no-repeat 0 -56px;
   clear: both;
}

如果你转到EXAMPLE,你可以

1 个答案:

答案 0 :(得分:2)

你需要让你的容器溢出隐藏,因为你是漂浮的孩子。

http://jsfiddle.net/xUf87/

的结帐代码