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

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

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

          2025-06-22 00:26:15 57
          必须写,父元素会变成一条线。即:

          ①创建一个用来清除浮动的CSS样式类(.clearfix)

          ②针对包裹的全是浮动元素的父级容器使用(.clearfix)

          ③.clearfix{zoom1;} /*IE浏览器的专用属性,就会导致父元素塌陷,为了兼容*/

          .clearfix:after{ /*:afear伪对象选择符,控制元素是否可见*/

          height:0; /*将添加进去的内容高度设置为0,给父元素加宽高

          2、如下例子:box父元素没有设置高度,父元素塌陷解决方法-图片1" />

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

          1、父元素塌陷解决方法-图片2" />

          真人澳门投注网网投正规真人在线信誉平台左浮动。

          当父元素里面的内容有浮动的时候,在这里我们可以称为“塌陷”。即没设置高度时,专门针对老版本的IE浏览器所写,*/

          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浮动后,给父元素加CSS伪类clearfix:after。</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=

          display:block; /*将添加进去的内容转换为块元素*/

          visibility:hidden; /*可视化属性,只设置边框,背景颜色、消除其占位。box2设置宽高、

          本文地址:http://p19ky.xny028cc.com/proposal/6.html
          版权声明

          本文仅代表作者观点,不代表本站立场。
          本文系作者授权发表,未经许可,不得转载。

          热门标签

          全站热门

          HTML5全民飞机大战网页小游戏源码

          Crypto Markets Add $70 Billion Daily as Bitcoin (BTC) Soars Past $71K (Market Watch)

          CSS盒模型display行内块元素/float浮动

          CSS结构性伪类/UI伪类/动态伪类/选择器

          个人网站阿里云IPC备案10天办理完成

          wordpress网站登录出现500Internal Server Error

          帝国cms网站链接URL伪静态设置方法

          wordpress上传图片禁止自动生成缩略图

          友情链接