Margin overlap problem

two adjacent div elements cause margin overlap.

Since the

margin overlap problem is caused by BFC, why do you assign a div overflow:hidden; attribute? there is still a margin overlap problem.

the method to generate BFC for an element is not to set the element attribute:
1.float: left | right | both;
2.overflow: hidden | auto | scroll;
3.display: table-cell | inline-block | table-caption;
4.position: absolute | fixed;
four methods?

I have tried the situation I have encountered so far, and only float, display: table-caption | inline-block and position can solve it.

Why not the overflow and display:table-cell properties?

Sep.03,2021

confuses "produce" with "place", one internally and the other externally. Change the overflow to let a div announce the new BFC internally, but externally it is still in the original BFC.


overflow is overflowed. If you say overflow is auto, and your boxes are float:left,width: infinitely wide, it will be arranged horizontally all the time, and the BFC of the browser will be disrupted.
display:table-cell is an attribute that allows tag elements to be rendered as table cells, similar to td tags, which turns boxes into cells, meaning that BFC

disrupts the parent box.
Menu