PDA

View Full Version : Div Inheritance



JimmyS
Dec 8th, 2006, 07:34 PM
Problem: I have a number of divs in a div container. The divs had an auto height so that the background would adjust to the amount of text in the div. The divs are side by side in the div container. If one div has more lines than the others only its height adjusts so it looks wanky.

Question: Is there a way to make all divs in my div container inherit the containers height and use it instead of just autoing their own?

I do not want to use a static height because other pages with have alternate text and it will not work properly.

rmedek
Dec 8th, 2006, 07:58 PM
That’s a pretty common question… the most used solution is probably

http://alistapart.com/articles/fauxcolumns/

and a method I've been using lately:

http://www.positioniseverything.net/articles/onetruelayout/equalheight

although it's not without its own set of problems (http://www.positioniseverything.net/articles/onetruelayout/appendix/equalheightproblems). Hope this helps…

JimmyS
Dec 8th, 2006, 08:53 PM
I used the second method and it worked PERFECTLY. Thank you very much. I like how you can have divs equal the height of two stacked divs as well.

rmedek
Dec 9th, 2006, 12:31 AM
Glad it's working. I've used that on a few production sites and am just hoping I don't run into any of the problems mentioned in the article. :D