Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS nested div height 100%

Tags:

css

I've currently got the #border div at 100% of the page height, but am trying to get the #container div to stretch to 100% inside #border. At the moment #container only stretches to fit the content inside it.

* {
    margin: 0;
}

html, body {
    height:100%;
    font-family: Georgia, Times, "Times New Roman", serif;
    font-size:13px;
    line-height:19px;
    color:#333333;
    background: #f5f1ec;
    text-align: left;
}

#border {
    background: #f5f1ec;
    border:solid 1px #FFFFFF; 
    width: 880px;
    margin: 40px auto 0;
    padding:10px;
    height: auto !important;
    min-height: 100%;
    height: 100%;
}

#container {
    background: #FFFFFF;
    padding: 10px 50px 0;
    height: 100%;
}
like image 704
Aaron Moodie Avatar asked May 28 '10 04:05

Aaron Moodie


People also ask

How do I change my height to 100% in CSS?

Syntax: To set a div element height to 100% of the browser window, it can simply use the following property of CSS: height:100vh; Example: HTML.

How do I make my inner div full height?

To set the height of the div element to 100% use height:100% the div element. It will set the height of the div element to 100% relative to the containing block.


2 Answers

Solved:

#container {
    background: #FFFFFF;
    padding: 10px 50px 0;
    height: 100%;
    width:780px;
    position:absolute;
}
like image 131
Starx Avatar answered Sep 28 '22 12:09

Starx


Try #container{min-height:inherit;position:absolute;}

and add overflow:hidden; to #border.

like image 45
edl Avatar answered Sep 28 '22 12:09

edl