Note: An element will overflow outside of its container if it is taller than the element that contains it and it is floated. This can be fixed with the “clearfix hack” (see example below).
Then, to address this issue, we can append the clearfix hack to the contained element: