<div class="parent"> <div class="child1"></div> <div class="child2"></div> <div class="clear"></div> </div>
.parent { width: 300px; background-color: pink; border: 1px solid pink; } .child1 { float: left; width: 100px; height: 50px; background-color: red; } .child2 { float: right; width: 100px; height: 50px; background-color: green; } .clear { clear: both; }