Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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?)