Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS expand div’s height to fit its container

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41026
    andytu
    Participant

    Hi:
    I have a container div with two inner divs, one below the other(not floated), and the first inner div with a fixed height. The question is: how can I make the second div to expand its height to fit its parent?

    #115674
    matt_sanford
    Participant

    I am not understanding what you are trying to accomplish. can you show us your code?

    #115692
    wolfcry911
    Participant

    Its parent is only as tall as the two child divs, unless you’ve set a height.

    #115702
    Schwarttzy
    Member

    Got it completely, so here you go http://codepen.io/anon/pen/qBneu

    Keep in mind it isn’t fool proof and has some pitfalls

    #115708
    pmac627
    Participant

    @Schwarttzy – .container needs to be height: 400px; not min-height: 400px;. Do that, and it works.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.