How do you keep parents of floated elements from collapsing? [duplicate]
Solution 1: The most reliable and unobtrusive method appears to be this: Demo: http://jsfiddle.net/SO_AMK/wXaEH/ HTML: <div class=”clearfix”> <div style=”float: left;”>Div 1</div> <div style=”float: left;”>Div 2</div> </div> CSS: .clearfix::after { content: ” “; display: block; height: 0; clear: both; } With a little CSS targeting, you don’t even need to add a class to the parent … Read more