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/48a7136244b4e13671abf722bbf1e2bb to your computer and use it in GitHub Desktop.
Save Gameonn/48a7136244b4e13671abf722bbf1e2bb to your computer and use it in GitHub Desktop.
CSS Grid Intro Challenge M2- Line 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: [header-start] 1fr [header-end box-start] 1.5fr [box-end main-start] 3fr [main-end footer-start] 1fr [footer-end];
grid-template-columns: repeat(3, [col-start] 190px [col-end]) 1fr [grid-end];
font-size: 20px;
color: #fff;
font-family: sans-serif;
& > * {
@include common;
}
}
.header {
grid-column: col-start 1/grid-end;
}
.sidebar {
grid-row: box-start/main-end;
}
.content {
grid-row: 3/4;
grid-column: col-start 1/col-end 3;
}
.footer {
grid-column: 1/-1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment