Skip to content

Instantly share code, notes, and snippets.

@LevPewPew
Created July 30, 2019 11:48
Show Gist options
  • Save LevPewPew/6ba634a0ad305efbad10dbc7d8db3346 to your computer and use it in GitHub Desktop.
Save LevPewPew/6ba634a0ad305efbad10dbc7d8db3346 to your computer and use it in GitHub Desktop.
CSS Grid Example 0, CodeCademy Excercise
.container {
display: grid;
max-width: 900px;
position: relative;
margin: auto;
grid-gap: 10px;
grid-template: repeat(12, 1fr) / repeat(6, 1fr);
}
h1,
h2,
h3 {
font-family: monospace;
text-align: center;
}
header {
background-color: dodgerblue;
grid-area: 1 / 1 / 3 / 7;
}
nav {
background-color: beige;
grid-area: 3 / 1 / 4 / 7;
}
.left {
background-color: dodgerblue;
grid-area: 4 / 1 / 9 / 5;
}
.right {
background-color: beige;
grid-area: 4 / 5 / 9 / 7;
}
.overlap {
background-color: lightcoral;
grid-area: 6 / 4 / 8 / 6;
z-index: 5;
}
footer {
background-color: dodgerblue;
grid-area: 9 / 1 / 13 / 7;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Grid Stuff</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="container">
<header>
<h1>Header</h1>
</header>
<nav>
<h1>Nav</h1>
</nav>
<section class="left">
<h2>Left</h2>
</section>
<div class="overlap">
<h3>Overlap!</h3>
</div>
<section class="right">
<h2>Right</h2>
</section>
<footer>
<h1>Footer</h1>
</footer>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment