div method - <div style="clear:both;"></div>..clearfix class above.overflow: auto or overflow: hidden method - Parent will establish a new block formatting context and expand to contain its floated children.In large projects, I would write a utility .clearfix class and use them in places where I need it. overflow: hidden might clip children if the children is taller than the parent and is not very ideal.
Adapted from the Front End Interview Handbook by Yangshun Tay and contributors (MIT License). Source
Spotted a mistake or a rights concern? Report an issue