View Full Version : How to make the wrapper stretch to the content?

07-10-2011, 03:14 PM
Say I had a background image which gives the impression of columns - and I put this on my #wrapper div... How can I make this #wrapper container stretch as I put content into my columns (which are inside the #wrapper)?

Presently, I can only get it to stretch down by giving the #wrapper an exact height but this is not satisfactory, as text resizing causes it to look ugly when the background does not repeat. Logically, div containers should stretch according to the size of what's inside them (this happens correctly with tables) - so how come my #wrapper div background won't continue repeating as I add more content to the child columns?

I have the background of the #wrapper set to repeat-y.

Also - how can I make it so that both columns (left and right) stretch equally together as I add content to either? I can do this with tables but if I add content to one column, the contents of the other column appears in the middle instead of at the top.

Sorry to bother you guys but I'm not sure how to phrase all that down into one sentence for Google.

Also - is height:100% valid? Does that work in CSS?

07-10-2011, 05:25 PM
I got it!

I floated lots of others things left and used relative positioning. Is that right? Why did I have to do this?