Results 1 to 2 of 2

Thread: How to make child div same height as parent?

  1. #1
    Join Date
    Jun 2005

    How to make child div same height as parent?

    I have a set of divs like

    <div id="div1">
    <div id="div2"></div> <div id="div3"></div>

    The content of 2 and 3 can make it so their heights are different, but I want to make it so they are always the same. So if div3 is taller than div2, div2 should stretch to be as tall as div3.

    I thought setting their heights to 100% would do the trick, since if div3 gets taller, then div1 must get taller making it so div2 is no longer at 100% height and would need to stretch back to 100%. But this doesn't work. How can I do this?

  2. #2
    Join Date
    Mar 2006
    Newcastle NSW Australia
    100% (or any percetage) height can only refer to the set height of the parent - if the parent's height is not explicitly set, then the percentage heights will default to "auto". Depending on the situation, the faux column technique can make it look like the columns are equal when in fact they aren't.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center