See Tutorial
Using grid-template-columns, grid-template-rows grid-gap
1
2
3
4
5
6

Using grid-template with repeat and fr (fractions)
1
2
3
4
5
6

Using grid-column: 1 / -1 to span entire width
HEADER
CONTENT

Using grid-template-areas
HEADER
CONTENT

Using auto-fit and minmax (only 2 top rows explicitly defined so below rows are implicitly created so height is differnt for them)
1
2
3
4
5
6
7
8
9
10
11
12
13

Using grid-auto-rows which defines for all rows (fixing above issue with height and making all rows have correct height)
1
2
3
4
5
6
7
8
9
10
11
12
13

Using grid-auto-flow: dense to fill move together all elements. It fills from left to right, top to bottom and sticks in what it can (change width of < body > to see how things change)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

Named Lines
HEADER
CONTENT

justify-content and align-content.
1
2
3
4
5
6

justify-items and align-items.
HEADER
CONTENT

auto-fit vs auto-fill.

AUTO-FIT

1
2
3

AUTO-FILL

1
2
3