当前位置:网站首页>BFC block level formatting context

BFC block level formatting context

2022-07-05 22:18:00 Front end students

BFC The understanding of the

  • Block level formatting context
  • Only Block box Participate in
  • It has nothing to do with the outside , Have your own set of rendering rules

Application scenarios

  • solve Sub elements float , Parent element height collapse problem
  • Cancel the box margin Collapse problem ( Child element set to margin-top, Both parent and child elements will be together margin-top( solve : Add... To the parent element overflow))

 Insert picture description here

  • Prevent being overwritten by floating elements ( Brother element floating , The following elements are not floating ( solve : Add overflow), The following elements will be covered by the previous floating elements )
     Insert picture description here

How to create BFC

  • float Not for none
  • display by inline-block flex by inline-flex
  • position Not for static or relative
  • overflow:hidden( best )
原网站

版权声明
本文为[Front end students]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140436125034.html