display: flow-root
A display value that makes an element a normal block which also starts a new block formatting context.
In more detail
The element behaves like a normal block from the outside. It is the modern, side-effect-free way to stop child margins collapsing through the parent and to contain floats.
Related terms
- block formatting context — A self-contained layout region in which blocks are laid out one after another and whose margins do not collapse with anything outside it.
- margin collapsing — The CSS rule that when two vertical margins of blocks touch, they merge into one margin equal to the larger of the two instead of adding up.
- display — The CSS property that sets how an element takes part in layout, such as block, inline, flex, grid or none.
Taught in
- Modern Box Model, Box Sizing, Display Types And Flow Layout — Frontend Architecture & Web Platform