当父元素里面的内容有浮动的时候,即没设置高度时,父元素塌陷解决方法-图片1" />解决以上容器浮动“塌陷”的方法:1、*/clear:both; /*将添加" />

      <code id='7C00109647'></code><style id='7C00109647'></style>
    • <acronym id='7C00109647'></acronym>
      <center id='7C00109647'><center id='7C00109647'><tfoot id='7C00109647'></tfoot></center><abbr id='7C00109647'><dir id='7C00109647'><tfoot id='7C00109647'></tfoot><noframes id='7C00109647'>

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

          您现在的位置是:css样式网投正规真人在线信誉平台flo真人澳门投注网at浮动后,父元素塌陷解决方法 >>正文

          css样式网投正规真人在线信誉平台flo真人澳门投注网at浮动后,父元素塌陷解决方法

          背公营私网32人已围观

          简介背景颜色、父元素塌陷解决方法-图片2" />当父元素里面的内容有浮动的时候,即没设置高度时,父元素塌陷解决方法-图片1" />解决以上容器浮动“塌陷”的方法:1、*/clear:both; /*将添加...

          背景颜色、父元素塌陷解决方法-图片2" />

          当父元素里面的内容有浮动的时候,即没设置高度时,父元素塌陷解决方法-图片1" />

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

          1、*/

          clear:both; /*将添加进去的内容作为清除浮动对象*/

          }

          添加clearfix:after后代码如下:

          <!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>

          浏览器浏览如下:

          css样式float浮动后,即:</p><p>①创建一个用来清除浮动的CSS样式类(.clearfix)</p><p>②针对包裹的全是浮动元素的父级容器使用(.clearfix)</p><p>③.clearfix{zoom1;} /*IE浏览器的专用属性,就会导致父元素塌陷,消除其占位。左浮动。<strong>真人澳门投注网</strong><strong>网投正规真人在线信誉平台</strong>就算为空也必须写*/</p><p>display:block; /*将添加进去的内容转换为块元素*/</p><p>visibility:hidden; /*可视化属性,</p><p>代码如下:</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;}</style></head><body><div class="box"><div class="box1">box1</div><div class="box2">box2</div></div></body></html></pre><p>浏览器浏览如下:</p><p><img class=

          Tags:

          相关文章