I'm trying to make a css grid layout such that it will accept new grid rows and where the first row will stretch in height to take the wasted space of a flex container (in black border) as its height is increased by the user, (350px in the .flex but variable by the user in real application).
My closest solution was to use grid-template-rows: auto minmax(36px, 36px) minmax(24px, 25px) minmax(24px, 35px); but that requires to be explicit about the rows, while these dynamically change in my application.
With grid-auto-rows: minmax(min-content, max-content); the rows rendered correctly and don't need to explicitly define them but can't get the first row to take up the space taken when explicitly defining the row with grid-template-rows: and assigning auto.
Thanks in advance for your help
.flex {
display: flex;
flex-direction: column;
height: 350px;
border: solid;
justify-content: flex-end;
}
.grid {
display: grid;
grid-gap: 10px;
grid-template-columns: minmax(100px, 207px) 1fr;
grid-auto-rows: minmax(min-content, max-content);
}
.grid>* {
background-color: green;
height: 42px;
}
#dgvContainer {
grid-column: 1/3;
}
#expander {
grid-column: 2/3;
background-color: white;
justify-self: end;
}
<div class="flex">
<div class="grid">
<div id="dgvContainer">1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div id="expander">Expander</div>
</div>
</div>
Fiddle: