Skip to content

Instantly share code, notes, and snippets.

@p410n3
Last active July 7, 2018 23:21
Show Gist options
  • Save p410n3/48d037dfd7871e10a25f40023bd31374 to your computer and use it in GitHub Desktop.
Save p410n3/48d037dfd7871e10a25f40023bd31374 to your computer and use it in GitHub Desktop.
My default CSS-Grid layout
body {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.grid {
width: 100%;
min-height: 100vh;
display: grid;
grid-template-rows: 80px 1fr 120px;
grid-template-columns: minmax(10px, 1fr) minmax(0, 800px) minmax(10px, 1fr);
grid-template-areas: "header header header"
". content ."
"footer footer footer";
}
.header {
grid-area: header;
background-color: blueviolet;
}
.content {
grid-area: content;
background-color: blue;
}
.footer {
grid-area: footer;
background-color: red;
}
<!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">
<title>GRID-CSS MAGIC</title>
<link rel="stylesheet" href="css/grid.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="grid">
<div class="header">
<h2>header</h2>
</div>
<div class="content">
<h2>content</h2>
</div>
<div class="footer">
<h2>footer</h2>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment