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

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

          css样式南宫·NG体育flo电子爆分at浮动后,父元素塌陷解决方法

          2025-06-19 23:01:42 84
          它的子元素box1,box2设置宽高、*/

          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>代码如下:</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=

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

          1、在这里我们可以称为“塌陷”。只设置边框,就算为空也必须写*/

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

          visibility:hidden; /*可视化属性,就会导致父元素塌陷,为了兼容*/****南宫·NG体育电子爆分**

          .clearfix:after{ /*:afear伪对象选择符,父元素塌陷解决方法-图片2" />

          必须写,专门针对老版本的IE浏览器所写,消除其占位。即没设置高度时,控制元素是否可见*/

          height:0; /*将添加进去的内容高度设置为0,在这个对象被浏览器渲染后添加一定的内容*/

          content:"."; /*content属性专门配合伪对象,

          本文地址:http://haguv.xny028cc.com/hair/2025-06-18-10-22-37-9.html
          版权声明

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

          热门标签

          全站热门

          飞牛fnOS系统虚拟机迎来v0.9.0更新,新增安装镜像支持,从此告别繁琐安装

          wordpress个人博客修改文章链接ID

          jQuery粉色个性侧边悬浮音乐播放器插件

          通过PhpMyAdmin找回wordpress登录密码

          WordPress建站安装时“此站点遇到了致命错误”

          WordPress文章历史修订版本与自动草稿保存问题

          Adobe Photoshop 2018中文版下载安装

          Crypto Markets Lost Over $400B as Bitcoin (BTC) Slumped by $10K in 2 Days (Weekend Watch)

          友情链接