margin塌陷

解决方法:

1、给父级顶加上一条线,不太合适。

2、bfc

block format context

设定bfc后,特定的盒子会遵循另一套语法规则,解决了margin塌陷

触发bfc元素

1)position:absolute;

2)display:inline-block;

3)float:left/right;

4)overflow:hidden; //溢出和隐藏

 

相关文章:

  • 2022-02-10
  • 2021-07-17
  • 2022-12-23
  • 2021-08-04
  • 2021-12-08
  • 2021-05-06
  • 2021-08-03
  • 2022-12-23
猜你喜欢
  • 2022-01-30
  • 2021-06-13
  • 2021-06-30
  • 2022-12-23
  • 2021-07-04
相关资源
相似解决方案