I was just working with Tom on trying to get some CSS to work properly for a project he’s working on.
The problem was divs flowing outside their parents. I was reminded of some pages I used to have up which demonstrate various div layout issues and show some fixes. I have now added them back into this site and they are here.
They key point for quite a few of the solutions there and hopefully for Toms’ solution (except its not quite finished yet) was that sometimes if you have some floats knowing around, it can be useful to have another, empty div with a style set to clear:both; this forces the floating to stop and makes the parent div expand (or should do anyway).
Oh yeah, an important resource that helped me to solve these problems was .
Iain Buckingham | 27-Feb-09 at 11:05 am | Permalink
Apparently there’s a way of doing it without putting non-semantic markup in the html (thought I haven’t tested it myself)
Jim Barritt | 27-Feb-09 at 12:15 pm | Permalink
Hi Iain,
Thanks for that, very useful – theres a really good demo page, much more complex than mine:
Apparently you just need to put “overflow:auto” or “overflow:hidden” in the containing div. Might have a go at it myself later and add an example.