Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gameonn/a6d52c44c16db05ef67b5ddbba290ba3 to your computer and use it in GitHub Desktop.
Save Gameonn/a6d52c44c16db05ef67b5ddbba290ba3 to your computer and use it in GitHub Desktop.
CSS Grid Intro Challenge M3- Grid Area Names
<div class="container">
<div class="header">Header</div>
<div class="small-box small-box-1">Small Box 1</div>
<div class="small-box small-box-2">Small Box 2</div>
<div class="small-box small-box-3">Small Box 3</div>
<div class="sidebar">Sidebar</div>
<div class="content">
Main Content
</div>
<div class="footer">Footer</div>
</div>
:root {
--pad: 1rem 2rem;
--bgcolor: orangered;
}
@mixin common {
background: var(--bgcolor);
padding: var(--pad);
}
.container {
background: #eee;
width: 800px;
display: grid;
margin: 30px auto;
grid-gap: 30px;
grid-template-rows: 1fr 1.5fr 3fr 1fr;
grid-template-columns: repeat(3, 190px) 1fr;
font-size: 20px;
color: #fff;
font-family: sans-serif;
grid-template-areas: ". head head ."
"box1 box2 box3 side"
"main main main side"
"foot foot foot foot";
& > * {
@include common;
}
}
.header {
grid-area: head;
}
.small-box-1 {
grid-area: box1;
}
.small-box-2 {
grid-area: box2;
}
.small-box-3 {
grid-area: box3;
}
.sidebar {
grid-area: side;
}
.content {
grid-area: main;
}
.footer {
grid-area: foot;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment