Stacked grid-template-areas
Hi everyone,
A quick question regarding stacked grid-template-areas.
Here is a grid with three columns and three rows. Simple enough.
.grid-container {
display: grid;
grid-template-columns: 1fr 3fr 1fr;
grid-template-rows: auto auto 100px;
grid-template-areas:
"header header header"
"sidebar content related"
"footer footer footer";
gap: 20px;
}
But in this example, I have one grid item stacked over another. How should I label the grid-template areas? Stack? When I redefine the grid area for the two grid items (.image and .text) the grid breaks down.
.grid-container {
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-template-rows: 1fr auto 1fr;
grid-template-areas: stack;
gap: 20px;
}
.image {
grid-area: 1 / 1 / 4 / 6;
}
.text {
grid-area: 2 / 2 / 3 / 4;
color: white;
}

Thanks.
Mark
