Created
June 13, 2023 22:52
-
-
Save theer1k/a761743cab0633370325bd99322f8c88 to your computer and use it in GitHub Desktop.
Grid Template CSS - Scrollable Main, sticky Header and Footer
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
body { | |
display: grid; | |
grid-template-areas: | |
'header' | |
'main' | |
'footer'; | |
grid-template-columns: auto; | |
grid-template-rows: auto 1fr auto; | |
min-height: 100vh; | |
} | |
.header { | |
grid-area: header; | |
position: sticky; | |
top: 0; | |
} | |
.main { | |
grid-area: main; | |
overflow-y: auto; | |
} | |
.footer { | |
grid-area: footer; | |
position: sticky; | |
bottom: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment