I am trying to see if it is possible to grow the height of a grid to fill the height of a parent container.
What I've tried:
I've tried setting 100% height/min-height on the grid container and child divs.
100vh isn't the solution as that will not be dynamic.
I'm a bit stuck on how to do this and if it is possible.
Any help with this is much appreciated. Thanks!
I've created a CodePen to try to figure this out here:
https://codepen.io/fylzero/pen/bGGvBPa
HTML
<div class="flex">
<div class="grid">
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
</div>
</div>
CSS
html, body {
display: flex;
flex-direction: column;
flex: 1 1 auto;
min-height: 100%;
}
.flex {
display: flex;
padding: 10px;
flex-direction: column;
flex: 1 1 auto;
min-height: 100%;
outline: 1px solid red;
}
.grid {
display: grid;
padding: 10px;
height: 100%; /* THIS DOESN'T DO IT */
grid-template-columns: 1fr minmax(auto, 400px) minmax(auto, 800px) 1fr;
grid-template-rows: 1fr;
grid-column-gap: 0px;
grid-row-gap: 0px;
outline: 1px solid green;
}
.grid div {
padding: 10px;
outline: 1px solid blue;
}