Hi,
You are mixing a few concepts there and I half answered this in your other thread
Containing floats and clearing floats are separate issues. You contain floats so that the parent will encompass the floats and you clear elements so that they clear the floated content.
First of all in your current structure you just need to add clear:both to the footer to effect the clearing.
Code:
#footer{clear:both}
No other fixes or css/html code are needed.
The footer will act as the clearing div itself - it does not need the height :1% and indeed that is dangerous to apply to real element as you may find the content limited to 1% in some cases. (As an aside the height:1% was a common hack to force layout in IE but is much safer to use zoom:1.0 instead even though it is invalid. Its no needed anyway because the element has a width which will already force haslayout).
Don't float the footer either as it is not needed to float.
If your code structure did not contain a footer or if the footer was outside #content-container then in order to make #content-container enclose the two floated columns you would use a containing technique such as the clearfix method or indeed just adding overflow:hidden to #content-container (assuming you don't need visible overflow). Overflow other than visible will contain child floats because it creates a new block formatting context and in that context will automatically take care of its child floats (the same as inline-block, display table, floats and absolutely positioned elements will as they all form new block formatting contexts).
Or using the old fashioned clearfix method you would do this:
Code:
#content-container:after{
content:".";
height:0;
visibility:hidden;
display:block;
clear:both;
}
#content-container{zoom:1.0}
This basically puts some generated content after the content in that container and then clears it - just like your footer is already doing.
Or you may want to look at the revised clearfix method.
However your current structure needs neither as you can simply add clear:both to the footer.
Bookmarks