View Full Version : Div help.

08-28-2011, 11:43 AM
Is there away to give one div height the value of another div area.

height: #div2;

so div area 1 is given the same height as div 2?

08-28-2011, 11:48 AM
How you do it depends on the relationship between the 2 divs.

You could do just

#div1, #div2 {
height: 100px;

or if div2 is a child of div1 and the height of div1 is dynamic then you could use the inherit value for the div2 height.

Post the html you have.

08-28-2011, 12:00 PM
yeah but i want the parent to have the same height as the child is that possible? but it to be dynamic and change according to each page and what is in that childs div.

08-28-2011, 01:06 PM
No need to define height for parent DIV.. it ll automatically stretched according to its child DIV...

If child div is floated element.. then you need to add overflow:auto property to parent DIV....


08-28-2011, 01:12 PM
Thanks its still not working 100% the way i want but i can work with it thanks for your help, your a good friend.