Because the list is floated inside the div, which takes it out of the document flow. To get it back in, you need to add a clear element after it (something as simple as <span style=“clear:left”> </span>). There are other, non-elemental ways to clear the float, but I have problems with those - this is simplest.
floats are a misnomer. They DONT float UP, a floated element must come FIRST in the markup. But your UL comes after your H1, so its essentially dropping out of the collapsed #header element (ronpat has already explaind the collapse ). For fun, switch the position of the H1 and the UL and not the change in behavior.
By default, floats shrinkwrap, but you can set explicit width. Floating something and giving it width:100% will cause the element to automatically drop. In other words the total width of the floated elements cannon exceed 100%.
Floated elements clear floated children. You must have noted this because it is likely you floated the UL to CLEAR the floated LIs ( BTW, you could have also cleared LIs by giving the UL overflow:hidden, or even display:inline-block; or display-table; etc. But each method has its own strength and drawback. In essence tho, you were close. What you wanted could have done was to ALSO FLOAT #header and give it width:100%. Of course that opens the can of worms of the box-model: since 100% + 5px left border+5px right border is > 100%. but there are lot’s of clever solutions as well it really just depends on the SPECIFIC situation.
Still, as ronpat said, the most general solution is overflow:hidden;
As always I am v gratefull for all input, your continued patience and thought out answers are such an asset to me
I feel I’m 80% there with the positioning clearing floats rules. I’ll pour over these posts & after a stong coffe and chocolate cake my grey matter may finally absorb the clearing floats rules.