The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> 100% height?, How to make the height of a div 100%
kyle246
post Jan 15 2012, 02:28 PM
Post #1


Member
***

Group: Members
Posts: 57
Joined: 29-January 11
Member No.: 13,738



I am trying to get my div container (my left side bar) to have a height of 100% so that it will fill up its parent container.

Here is the css code for my parent container (I am also using clearfix so it expands)
CODE

#boxicreated{
    height:100%;
    border:1px #000 solid;
}


Here is the css code for the child container which is my left side bar
CODE

#primary {
    width:190px; /*+10px padding*/
    float:left;
    margin-left:-800px;
    padding:0 10px 0 0;
    background:#eaeaea;
    min-height:100%;
    height:100%;
}


I made a black 1px border around my parent div so you can easily see it. My child container is the left sidebar which has a light grey background. I want that child container to expand downwards until it hits the end of its parent container..

The website is "pokemonsocial.com" (currently this is only on the home page.)

Any help would be awesome.

Thanks,
Kyle
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 15 2012, 03:02 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Is #boxicreated the correct height? Of what is it 100%?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
kyle246
post Jan 15 2012, 04:10 PM
Post #3


Member
***

Group: Members
Posts: 57
Joined: 29-January 11
Member No.: 13,738



I created the #boxicreated just so I could try to make my child container expand its height to 100% of the parent container.

The 100% on the #boxicreated is there because I read somewhere online that it might work but it didn't. The #boxicreated would display the same with or without the 100% height.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jan 15 2012, 05:58 PM
Post #4


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



All parents need a height in percent, until you either reach the root element (HTML) or a parent with an absolute height value. For example:

CODE
html, body, #boxicreated {height: 100%;}

or

CODE
body {height: 200px;}

#boxicreated {height: 100%;}




User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
kyle246
post Jan 16 2012, 12:07 AM
Post #5


Member
***

Group: Members
Posts: 57
Joined: 29-January 11
Member No.: 13,738



i kinda fixed the problem. thanks for everyones help
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2024 - 03:14 PM