I have a CSS grid where some elements span multiple rows. I'm trying to get the lower elements to fit snugly against the element above them, but they keep sticking to the bottom of the grid.
Setting align-items to start or stretch doesn't help at all.
ul {
display: grid;
grid-template-areas:
"a b"
"c b"
"c d";
grid-template-columns: repeat(2, minmax(140px, 1fr));
grid-template-rows: repeat(3, auto);
grid-gap: 10px;
align-items: start;
}
.a { grid-area: a; }
.b { grid-area: b; height: 5em; }
.c { grid-area: c; height: 10em; }
.d { grid-area: d; }
<ul>
<li class="a">A</li>
<li class="b">B</li>
<li class="c">C</li>
<li class="d">D</li>
</ul>
This makes A and C touch, but B and D do not touch (unless you fill up D with more text). I want to make B & D touch, leaving a gap to the bottom (or causing D to fill the entire space).
Fiddle here: https://jsfiddle.net/JasonTank/Ltkhn6so/14/