Having read a tutorial (which has confused me) they suggest there is another technique i can make the footer clear the floated columns by using overflow hidden e.g:
{
float: left;
width: 900px;
overflow:hidden;
}
But alas when i try this the layout breaks So my question is please: âWhat bit css would i need to add to the #content-container to clear the floated columns & push the footer in place if i did not want to add clear:both; in the footer?â
Iâm on a mobile now, so canât say why the page breaks, but it shouldnât. Overflow: hidden should work fine, but the common alternative is the âclearfixâ method.
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.
#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: