DIV 浮动存不占空间
比如
<div style="width:80px; border:1px solid #333">
<div style="float:left; height:50px; width:20px; background:#CCC"></div>
<div style="float:left; height:70px; width:50px; background:#000"></div>
</div>
你会发现因为里面的2个元素浮动,所以外面的DIV高度还是2px 2px是边框的。
浮动元素不占空间,
所以一般在下面加一个清除浮动就可以解决这个BUG
<div style="width:80px; border:1px solid #333">
<div style="float:left; height:50px; width:20px; background:#CCC"></div>
<div style="float:left; height:70px; width:50px; background:#000"></div>
<div style=" clear:both"></div>
</div>

相关文章:

  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-08-14
  • 2021-06-04
  • 2021-09-14
猜你喜欢
  • 2021-06-13
  • 2022-12-23
  • 2021-07-04
  • 2022-02-14
  • 2021-10-01
  • 2021-11-04
  • 2021-11-21
相关资源
相似解决方案