April 27, 201016 yr Hey, I have been experiencing this issue for a number of years and have never actually my desirable way around it, so thought I'd ask and see if anyone has any clues. Basically if I have a div that has a contained div that floats to the left, then the parent will not stretch to the height of the floated div. For example if I did something along these lines: <div style="background-color: #000000;"> <div style="float: left;"> <p>put a bunch of content here</p> </div> </div> The background should be black behind all the content of the contained div, but instead it would not resize the div to the height of the contained one. Anyone experienced this before and found a way around it that does not involve explicitly declaring the height of the parent?
April 27, 201016 yr Just add overflow:auto to the CSS for the parent and it will expand to accommodate floated elements.
Create an account or sign in to comment