HTML & CSS · Middle · Question 30 of 75
What is a block formatting context (BFC), and how do you create one?
- 1A group of consecutive sibling elements with the same
display: block - ✓Correct answer: An isolated layout region: contains floats, prevents margin collapse;
display: flow-root - 3Any semantic container such as
<section>or<article>
Explanation
A BFC is an isolated layout region: it contains its floats (doesn't collapse in height) and prevents children's margins from collapsing with the parent's. It's created by display: flow-root (the modern way), overflow other than visible, flex/grid items, position: absolute, etc. It used to be the clearfix technique.