I have been experimenting a bit with CSS Grid and trying to develop a simple webpage. I am using the fr
unit to evenly create display my content and make it responsive. The columns are evenly created to fill up the space of the screen. But the rows on the other hand are not filling up the space. They are being created but not to fill up the whole height of the screen.
Here is my HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="style.css" type="text/css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900" rel="stylesheet">
<title>Name of Site</title>
</head>
<body>
<div class="container">
<header class="header box">
<h1>Name</h1>
</header>
<nav class="info box">
<h2>General Information</h2>
</nav>
<div class="right box">
<h3>Right</h3>
</div>
<footer class="footer box">
<h2>Footer</h2>
</footer>
</div>
</body>
</html>
Here is my CSS Code:
/* Resets */
body {
margin: 0;
}
/* Typography */
h1, h2, h3 {
font-family: 'Roboto';
text-align: center;
font-variant-caps: all-petite-caps;
}
ul, li, p {
font-family: 'Roboto';
}
.box {
color: #ffffff;
padding: 10px 10px;
}
/* CSS Grid */
@media (min-width: 960px) {
.container {
display: grid;
grid-template-areas:
"h r"
"i r"
"f r";
grid-template-columns: 1fr 2fr;
grid-template-rows: 1fr 3fr 1fr;
}
}
.header {
grid-area: h;
background-color: #57B8BF;
}
.info {
grid-area: i;
background-color: #3A7B7F;
}
.footer {
grid-area: f;
background-color: #1D3D40;
color: #ffffff;
}
.right {
grid-area: r;
background-color: #ffffff;
color: black;
}
The result I keep getting is this:
.
I have the Firefox Grid display so you can see how the grid is laid out. But i the image I have written in red the space that is now being included when making a the rows. Isn't the footer suppose to be at the end within its column?
How do I get the rows to evenly distribute the height of the page jsut like it is being done with the columns?