A Pen by Ankit Jindal on CodePen.
Created
July 16, 2022 12:57
-
-
Save Gameonn/48a7136244b4e13671abf722bbf1e2bb to your computer and use it in GitHub Desktop.
CSS Grid Intro Challenge M2- Line Names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: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