In this example, the image is taller than the element containing it, and it is floated, so it overflows outside of its container:
Add the clear fix hack to the containing element, to fix this problem:
.clearfix::after { content: ""; clear: both; display: table; }