Grid items can be layered using the z-index
property, allowing for more complex layouts and overlapping content.
.grid-container {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 1fr;
}
.grid-item {
grid-column: 1 / -1;
grid-row: 1 / -1;
}
.item1 {
background-color: rgba(255, 0, 0, 0.5);
z-index: 1;
}
.item2 {
background-color: rgba(0, 0, 255, 0.5);
z-index: 2;
}