flow-root creates new BFC on element, wich prevent margins of children elements from "leaking". column-count and overflow fallbacks also creates new BFC, so there is no problems with them. But clearfix fallback doesn't create new BFC and margin-top "leaks" from children elements.
Here is the simple pen that illustrates this issue.
If we want to be closer to spec, than we should replace clearfix from
.clearfix::after {
content: '';
display: table;
clear: both;
}
to
.clearfix::before,
.clearfix::after {
content: '';
display: table;
}
.clearfix::after {
clear: both;
}
flow-rootcreates new BFC on element, wich prevent margins of children elements from "leaking".column-countandoverflowfallbacks also creates new BFC, so there is no problems with them. Butclearfixfallback doesn't create new BFC andmargin-top"leaks" from children elements.Here is the simple pen that illustrates this issue.
If we want to be closer to spec, than we should replace clearfix from
to