Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inner div needs to be 100% height

Tags:

html

css

Here is my HTML:

<div id="container">
    <div id="left-container">
    </div>

    <div id="right-container">
    </div>
</div>

The container is 100% height (I checked it with Firebug). But the #left_container needs to be 100% too and it isn't!

Below is my CSS and a screenshot. The yellow should be 100%. Yellow is the background of the #left-container

html, body {
    height: 100%;
}
#container {
    position:relative;
    margin: 0 auto;
    width: 100%;
    height:100%;
    height: auto !important;
    min-height:100%;
    background: #fff;
}
#left-container {
    width: 300px;
    background: #ff0;
    height:100%;
    height: auto !important;
    min-height:100%;
}
like image 291
Stijn Leenknegt Avatar asked Oct 21 '11 17:10

Stijn Leenknegt


1 Answers

This article discusses both the issue and solution in detail:

http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks

This might help too:

<style>
    #outer {position:absolute; height:auto; width:200px; border: 1px solid red; }
    #inner {position:absolute; height:100%; width:20px; border:1px solid black; }
</style>

<div id='outer'>
    <div id='inner'>
    </div>
    text
</div>

See here for more details on the above:
How to make a floated div 100% height of its parent?

like image 145
James Johnson Avatar answered Oct 27 '22 04:10

James Johnson