PDA

View Full Version : Growing container divs


stevenradams
07-06-2009, 11:15 AM
Hello all :)

just a quick Q: is the 'overflow' principle in css the right area to be looking if I want a container div to grow when a div it is holding grows?

I've a template file that is being used across my site, and on one or two of the pages (such as the blog page) the content div inside the container outgrows the container div.

I've tried various settings for the container (overflow=visible/auto etc), but none do what I want. I DON'T want it to scroll, instead I just want it to grow as necessary...

Incidentally the height for the container div is set at 100%.

You can see the site in its embryonic stages at www.adamsapplemedia.co.uk, though currently I've got a scroll on the content div until I figure this out.

Really appreciate any help, as always.

Steve

domedia
07-06-2009, 04:42 PM
Hello all :)

just a quick Q: is the 'overflow' principle in css the right area to be looking if I want a container div to grow when a div it is holding grows?
Nope, this should be default behavior. 'Overflow' is to be used when the content of one element is to large for it's parent element. In your case all you have to do is not to restrict the parent element in size and it will automatically grow/stretch.

stevenradams
07-07-2009, 08:30 AM
Aah – and indeed that was my problem. I was focusing on the on overflow setting of the parent, and ensuring its height setting was % not absolute and getting confused, when the issue was that I'd set the absolute height of the child div, but with an auto overflow. So although the child div overflowed, it didn't grow as such... make sense?