Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Botos Claudia
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Botos Claudia
Front End Web Development Techdegree Graduate 18,765 Points

The height of the body does not take up to 100%

I want to ad an aside nav li and add the height of 100% to it, but it does not take the full height of the window. I even added html and body together a height of 100%, it made it longer but still not to full height. Could someone help me please! I googled it the whole day and haven't been able to find a solution . Thanks in advance!

2 Answers

Kallil Belmonte
Kallil Belmonte
35,561 Points

For the property "height: 100%" to work, the parent must have a fixed height (example: height: 200px).

So depending the case you could use:

 height: 100vh;

or

position: absolute;
top: 0; (or 100px - the 100px would be the size of the menu/element above)
bottom: 0;

Maybe try to set the value in 'vh' instead of a percentage? For example:

height= 100vh;

Or set the body's margins to 0?

body {
margin: 0;
}

(and maybe the padding, too?)