Skip to content

Instantly share code, notes, and snippets.

@theer1k
Created June 13, 2023 22:52
Show Gist options
  • Save theer1k/a761743cab0633370325bd99322f8c88 to your computer and use it in GitHub Desktop.
Save theer1k/a761743cab0633370325bd99322f8c88 to your computer and use it in GitHub Desktop.
Grid Template CSS - Scrollable Main, sticky Header and Footer
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