Created
September 19, 2022 16:16
-
-
Save saintsGrad15/aad135ad03d4e72900222bcb35b774ce to your computer and use it in GitHub Desktop.
Cause body to fill the viewport, establish a CSS Grid with a header, left-nav and main body. The nav and body will scroll independently, the body will not scroll.
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
<template> | |
<div id="mainLayout"> | |
<div id="header"></div> | |
<div id="leftNav"></div> | |
<div id="mainView"></div> | |
</div> | |
</template> | |
<style> | |
html, body { /* nothing necessary */ } | |
#mainLayout { | |
height: 100vh; | |
display: grid; | |
grid-template-columns: max-content 1fr; | |
grid-template-rows: max-content minmax(0, 1fr); | |
grid-template-areas: | |
"header header" | |
"nav main"; | |
overflow-y: hidden; | |
} | |
#mainLayout > * { | |
min-height: 0; | |
} | |
#header { grid-area: header; } | |
#leftNav { grid-area: nav; } | |
#mainView { grid-area: main; } | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment