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

Michael Hampshire
12,206 PointsHow can I make a flex box take up 100% of the view port?
I'm trying to get a flex container to take up 100% of the view port (no matter the screen size). How can I do it? The 100% height in the .container style isn't taking up the full screen. This is what I have so far:
<!DOCTYPE html>
<html>
<head>
<title>Mike Hampshire | Web Designer</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/flexbox.css">
<link href="https://fonts.googleapis.com/css?family=Amatic+SC" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="header">
<h1 class="main-title">Mike Hampshire<br>Web Developer</h1>
</div>
<div class="main-content">
</div>
<div class="button">
<input type="button" name="enter-button" value="Enter">
</div>
<div class="footer">
<div class="main-footer">© Mike Hampshire 2017</div>
</div>
</div>
</body>
</html>
body {
background-image: url("../img/me.png");
background-repeat: no-repeat;
background-position: center bottom;
background-attachment: fixed;
}
.container {
display: flex;
flex-wrap: wrap;
height: 100%;
width: 100%;
background-color: blue;
}
1 Answer

Michael Hampshire
12,206 PointsNevermind, I figured it out. Instead of using height: 100%, I used height: 100vh. That way it always takes up 100% of the viewport height.