COMP 126: Practical Web Design & Development for Everyone
.grid-container {
display: grid;
background-color:grey;
width: 80%;
height: 100vh;
margin: 0 auto;
}
<div class="grid-container">
</div>
1. create a grid container with your chosen proportions and measurements
.grid-container {
display: grid;
grid-template-columns: 1fr 1.5fr 1fr;
grid-template-rows: 1fr 1fr 5fr auto;
background-color:grey;
width: 80%;
height: 100vh;
margin: 0 auto;
}
<div class="grid-container">
</div>
2. define columns and rows with the desired measurements/proportions to match your sketch (the lines that you see in the image to the right will be invisible, but they'll be there)
.grid-container {
display: grid;
grid-template-columns: 1fr 1.5fr 1fr;
grid-template-rows: 1fr 1fr 5fr auto;
background-color:grey;
width: 80%;
height: 100vh;
margin: 0 auto;
}
<div class="grid-container">
<header></header>
<div class="description">
</div>
<main></main>
<footer></footer>
</div>
3. add containing elements to the areas where you want them using any of the grid placement methods
<div class="grid-container">
<header>
<div class="logo">
<img src="logo.jpg" alt="logo">
</div>
</header>
<div class="description">
<div class="intro-text">
<h2>
text text text
</h2>
</div>
</div>
<main>
<img class="big-img" alt="big image">
</main>
<footer>
<aside class="left-aside"></aside>
<nav class="subgrid-menu">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</nav>
<aside class="right-aside"></aside>
</footer>
</div>
add content to the containers!
You can tell an element to start at a particular grid line and span a specified number of columns/rows
use the minmax() function to set parameters for grid tracks