The idea
A child's top margin can collapse *through* its parent and push the whole parent down. contain: layout gives the parent its own independent formatting context, which stops the margin escaping — the parent stays put and grows to contain the child.
display, overflow, padding and border are off-limits — each of them would also stop the margin escaping, and the point is to learn contain: layout.