treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Nested Height Inheritance

  • Hi. I'm wondering if it's possible to inherit the height of a parent where the parent's height is set to auto? What I would like is the child element below to size itself to the parent, but really, the content element is what sets the height. Is this possible?

    For example:

    div#parent{
    height: auto; /* yeah yeah... I know that this is redundant since it's the default. :-) */
    }

    div#child{
    height: inherit;
    border:#000 1px solid;
    }

    div#content{
    height:auto;
    }


    HTML:

    <div id=\"parent\">
    <div id=\"child\"></div>
    <div id=\"content\">
    Oh... the misery of floating elements.
    </div>
    </div>
  • You meant "height: 100%"? ;)