在这里我们可以称为“塌陷”。父元素会变成一条线。左浮动。背景颜色、必须写" />

      <code id='3153E801DB'></code><style id='3153E801DB'></style>
    • <acronym id='3153E801DB'></acronym>
      <center id='3153E801DB'><center id='3153E801DB'><tfoot id='3153E801DB'></tfoot></center><abbr id='3153E801DB'><dir id='3153E801DB'><tfoot id='3153E801DB'></tfoot><noframes id='3153E801DB'>

    • <optgroup id='3153E801DB'><strike id='3153E801DB'><sup id='3153E801DB'></sup></strike><code id='3153E801DB'></code></optgroup>
        1. <b id='3153E801DB'><label id='3153E801DB'><select id='3153E801DB'><dt id='3153E801DB'><span id='3153E801DB'></span></dt></select></label></b><u id='3153E801DB'></u>
          <i id='3153E801DB'><strike id='3153E801DB'><tt id='3153E801DB'><pre id='3153E801DB'></pre></tt></strike></i>

          您现在的位置是:css样式flo赛车彩票平台app财富at浮动后,父元素塌陷解决方法云开体育app官方网站升级 >>正文

          css样式flo赛车彩票平台app财富at浮动后,父元素塌陷解决方法云开体育app官方网站升级

          赤贫如洗网15人已围观

          简介控制元素是否可见*/height:0; /*将添加进去的内容高度设置为0,它的子元素box1,父元素塌陷解决方法-图片2" />在这里我们可以称为“塌陷”。父元素会变成一条线。左浮动。背景颜色、必须写...

          控制元素是否可见*/

          height:0; /*将添加进去的内容高度设置为0,它的子元素box1,父元素塌陷解决方法-图片2" />

          在这里我们可以称为“塌陷”。父元素会变成一条线。左浮动。背景颜色、必须写,即没设置高度时,给父元素加宽高

          $$$$云开体育app官方网站升级$$2、赛车彩票平台app财富父元素塌陷解决方法-图片1" />

          解决以上容器浮动“塌陷”的方法:

          1、

          当父元素里面的内容有浮动的时候,box2设置宽高、只设置边框,

          代码如下:

          <!doctype html><html><head><meta charset="utf-8"><title>css容器浮动塌陷</title><style>.box{border:10px solid red;}.box1{width:30%;height:100px;background:blue; float:left;}.box2{width:70%;height:100px;background:#3FC3AC; float:left;}</style></head><body><div class="box"><div class="box1">box1</div><div class="box2">box2</div></div></body></html>

          浏览器浏览如下:

          css样式float浮动后,消除其占位。*/</p><p>clear:both; /*将添加进去的内容作为清除浮动对象*/</p><p>}</p><p>添加clearfix:after后代码如下:</p><pre><!doctype html><html><head><meta charset="utf-8"><title>css容器浮动塌陷</title><style>.box{border:10px solid red;}.box1{width:30%;height:100px;background:blue; float:left;}.box2{width:70%;height:100px;background:#3FC3AC; float:left;}.clearfix:after{clear:both; display:block; content:"."; visibility:hidden;height:0;}.clearfix{zoom:1;}</style></head><body><div class="box clearfix"><div class="box1">box1</div><div class="box2">box2</div></div></body></html></pre><p>浏览器浏览如下:</p><p><img class=

          Tags:

          相关文章