Layout bug is hidden in plain sight.
.dashboard {
display: grid;
grid-template-columns: repeat(3, minmax(120px, 1fr));
gap: 12px;
}
.card {
grid-column: span 4;
padding: 12px;
border: 1px solid #ddd;
}
@media (max-width: 700px) {
.dashboard {
grid-template-columns: 1fr;
}
}
Reply with what is broken and how you would fix it.
1 Like
That grid-column: span 4; on . card is busted, because your grid only defines 3 columns. In CSS Grid, spanning past the explicit columns makes the item create an implicit extra column, so you get weird overflow/spacing like your layout is “making a 4th lane” nobody asked for. Fix is just to span what exists (or don’t span at all if every card is the same size):
.card { grid-column: span 3; } /* or just remove grid-column */
@media (max-width: 700px) { .card { grid-column: 1 / -1; } }
I found a related kirupa. com article that can help you go deeper into this topic:
1 Like