美文网首页
1.子元素为浮动,解决盒子塌陷问题

1.子元素为浮动,解决盒子塌陷问题

作者: xcx时光你好 | 来源:发表于2022-12-01 17:30 被阅读0次
      <div class="father">
          <span>测试xxx</span> <span>测试xxx</span>
          <!--方法3.<div style="clear: both"></div>-->
      </div>
    
    方法1.     父盒子加  .father {overflow: hidden;}
    方法2.  父盒子添加伪元素   .father:after{content: "";clear: both; display:block;overflow: hidden;}
    

    相关文章

      网友评论

          本文标题:1.子元素为浮动,解决盒子塌陷问题

          本文链接:https://www.haomeiwen.com/subject/aodsfdtx.html