In previous versions of Chrome, you could define grid-template-rows
such that certain rows were fixed height and others would expand like the flex model. This no longer appears to be the case and I have provided a fiddle as an example.
The header
and footer
div have their height set to 100px, and their template-row value set to auto
. The main
div has no height defined and its template-row value is set to 1fr
. The expected behavior is that the main
div should fill the remaining height of 800px, but its client height is zero.
My question, with respect to the fiddle, why is the main
div not expanding to fill the remaining height of the grid
div?
.container {
display: flex;
min-height: 1000px;
flex-direction: column;
}
.grid {
display: grid;
flex: 1;
grid-template-areas:
"header"
"main"
"footer";
grid-template-rows: auto 1fr auto;
justify-items: stretch;
align-items: stretch;
}
.header {
grid-area: header;
background-color: red;
height: 100px;
}
.main {
grid-area: main;
background-color: green;
}
.footer {
grid-area: footer;
background-color: blue;
height: 100px;
}
<div class="container">
<div class="grid">
<div class="header"></div>
<div class="main"></div>
<div class="footer"></div>
</div>
</div>