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

height: 100% doesn't work

When I write this code, my browser doesn't accept this value

1 Answer

height: 100% only works for elements that are inside another element that has a defined height.

In other words, what height: 100% means is "I want this element to be 100% as tall as its parent element."

If you want to make an element as tall as the screen that your user is viewing your webpage on, you can use height: 100vh, but this is a new feature that isn't available on older browsers.

Another option is to use JavaScript or jQuery to set the height of your element.