Set CSS Grid item width
2019-09-06
In CSS Grid, you specify the size and position of elements with grid-column
and grid-row
.
Normally you specify the position with {start-position} / {end-position}
.
But you can also specify the width with span
:
#item {
/* 3 columns wide, 2 rows high */
grid-column: 1 / span 3;
grid-row: 1 / span 2;
}
Check out this codepen example.