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

Resizable Website

Hey everybody.

I just wanted to ask if there was anyway to take up 100% of the viewport on any device? The way that I have my website right now, is I have the main div taking up 100% of the viewport and that works fine on my computer. If I add padding or anything to the text inside however, the viewport expands past where I want it to go. Is there anyway to stop this? Thanks!

Garrett Sanderson
Garrett Sanderson
12,735 Points

If I am understanding you correctly without seeing any of your code I think you are looking for something like this.

.some-class {
width: 100vw;
height:100vh;
}

vw: viewport width and vh: viewport height and set to 100 will take up 100% of whatever device you are on.