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

2022-12-01  本文已影响0人  xcx时光你好
  <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;}
上一篇 下一篇

猜你喜欢

热点阅读