I'm trying to create a 3 x 3 grid in flexbox css along with a fixed height header.
I've managed to do this, but I want the total height of this to be 100%. At the moment the fixed height header (say 80px) causes my total height to be 100% + 80px.
How can I keep everything within 100% of the screen height?
Here is the code I tried:
* {border: 0; padding: 0; margin: 0; }
html, body, .grid { height: 100%; width: 100%;}
.container {
display: grid;
grid-template-columns: auto auto auto;
background-color: lightgray;
}
.item {
text-align: center;
border: 1px solid gray;
}
<div class="header">LOGO</div>
<div class="grid container">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
<div class="item">7</div>
<div class="item">8</div>
<div class="item">9</div>
</div>