Grid columns in CSS
A grid defined by its column track list, with content flowing into rows.
.layout {
display: grid;
grid-template-columns: 16rem 1fr;
gap: 1.5rem;
}
.metrics {
display: grid;
grid-template-columns: repeat(4, 1fr);
column-gap: 1rem;
row-gap: 2rem;
}
How it works
repeat()saves writing the same track twice.frdivides the space left after fixed tracks.gapapplies to both axes unless you split it.
Keywords and builtins used here
displaygapgridlayoutmetricsremrepeat
The run, in numbers
- Lines
- 12
- Characters to type
- 174
- Tokens
- 48
- Three-star pace
- 80 tpm
At the three-star pace of 80 tokens a minute, this run takes about 36 seconds.
Step 1 of 7 in Grid, step 7 of 24 in Flexbox & grid.