The red vertical line is within the yellow container, floated right. The green boxes are outside of it, floated right. The yellow container is not floated. Every element is a div with hardcoded height and width. Try to understand why the red line is rendered outside of the yellow container. There are three ways to fix the problem: