CSS Grid Practice

Tracks: rows and columns

Lines: between tracks

1
2
3

Gutters: gaps between tracks, like thick lines. Places at the end of a gutter.

1
2
3

Explicit grid: defined by grid-template-rows and grid-template-columns

Implicit grid: auto created tracks for items that don't fit in explicit grid

Explicit 1
Explicit 2
Implicit 1
Implicit 2

Explicit grid lines can be referenced. Implicit cannot

Explicit 1
Explicit 2
Implicit 1
Implicit 2

Fractional units define tracks as ratios

1
2
3

repeat() to define multiple tracks

1
2
3

items will be placed along lines and may overflow

1
2
3

min-content: length of the largest minimal content in the track, not the element width. e.g. longest word 4444

1 22 333 4444
22 1 1 1 1 333

max-content: length of the largest maximal content in the track. e.g sentence rather than word

999999999 0
1 2 3 4 5 6 7 8 9 10

minmax: specify track dimension range

1
2
3

auto: as min value, takes up the largest minimum size or content

1
22
333
1
2
3

auto: as max value, max-content, won't overflow

1
2
3

auto: as a column takes up remaining space. think: minmax(min-content, max-content)

1
2
3

auto-fill and auto-fit are responsive grids. alternative is fixed tracks and media queries to layout grid areas.

auto-fill: inserts new columns

1
2
3
4
5

auto-fit: inserts new columns, collapses empty ones, and distributes space. fit space into existing tracks

1
2
3
4
5

auto-fit, auto-fill column tracks are explicit grid and can be referenced, but row tracks are still implicit

1
2
3
4
5

grid-auto-flow: defaults filling rows, can fill columns first

1
2
3
4

grid-auto-flow: `dense` fills gaps for items that don't have semantic ordering.

1
2
3
4

Item placement

align-items: block axis grid item placement for all items in grid container

1
2

align-self: block axis grid item placement

1
2

justify-items: inline axis grid item placement for all items in grid container

1
2

justify-self: inline axis grid item placement

1
2

Track placement

align-content: block axis tracks placement

1
2

justify-content: line axis tracks placement

1
2