BFC
withIFC
-
Are
Box
designed forformating content
-
css
When rendered inbox
the basic unit,box
the type of elements and the type ofdisplay
value determined. box dividedblock-level box
andinline-lever box
-
formating content
: Rules followed by different rendering regions
BFC
--Block level formatting context
When will it be formed?
-
overflow
Not forvisible
-
float
Not fornone
-
display
forflex table-cell table-caption inline-block inline-flex
-
Root element
BFC
characteristic
-
Block-level elements inside the area are placed one after the other vertically
-
Area does not overlap with floating element
-
The distance between elements is determined by the vertical direction
margin
-
If there are both upper and lower elements, there
margin
will be overlap -
When calculating the height inside the area, floating elements are also included in the calculation
-
Is an isolated container on the page, internal and external does not affect each other
IFC
--Inline format context
-
inline
Elements and layout specifications that theinline-block
elements conformIFC
to
characteristic
-
In the area, inline elements are placed one after another in the horizontal direction.
-
Among them, the horizontal direction
margin, padding, border
is effective. But not vertically -
All the blocks in a horizontal line form a rectangular area named
line box 行框
-
line box
The height of is calculated from the highest height of the elements it contains. Sometimes it is higher than the highest element, such as when the baseline is aligned. When theline box
height is greater than the height of the elements, the arrangement of the elements in the vertical direction isvertical
determined by -
The width is determined by the width of the element that contains it and whether there are floating elements in the element that contains it. If the element containing it is wide enough,
line box
the horizontal arrangement istext-align
determined, otherwise it will beline box
truncated and wrapped. If itline box