The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS Divs Not Adjusting for Body Content Re: CSS Divs Not Adjusting for Body Content


That is due to you floating the image to the right. Floated elements are removed from the normal flow of the document, meaning that parent elements won’t naturally expand to contain them.

Firstly, rather than using HTML attributes to set height/width and so on, use CSS. Secondly, to get the parent element to contain the floated image you will need to use a clearfix of some sort. Here is one I like to use:

.cf:before {
content: '';
display: table;
.cf:after {
clear: both;
.cf {
zoom: 1;