【问题标题】:Child Div interrupts Parent Div repeat-y backgroundChild Div 中断 Parent Div 重复背景
【发布时间】:2012-07-10 18:37:08
【问题描述】:

我目前有一个带有重复 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: #内容 { 向左飘浮; 边距:5px 自动; 边框:红色 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;
}

如果你去你可以

【问题讨论】:

  • 使#container-body 溢出:隐藏;

标签: html css


【解决方案1】:

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

结帐代码http://jsfiddle.net/xUf87/

【讨论】:

    猜你喜欢
    • 2019-10-14
    • 1970-01-01
    • 2017-12-04
    • 2017-02-21
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多