--- name: layout-grid description: CSS Grid utilities including grid-cols, grid-rows, gap, place-items, and grid placement --- # Grid Utilities for CSS Grid layouts: columns, rows, gap, and item placement. ## Usage ### Grid columns and rows ```html
3 equal columns
Responsive
No explicit tracks
3 rows
Custom rows
``` ### Custom grid template ```html
Custom template
CSS variable
``` ### Subgrid ```html
01
02
03
04
05
06
``` ### Gap ```html
Uniform gap
Different x/y
``` ### Place items (align + justify) ```html
Center both
Start both
Equivalent
``` ### Grid placement (col/row span and start) ```html
Spans 2 columns
Starts at col 3
Spans 2 rows
Full width
``` ## Key Points - `grid` / `inline-grid` - Grid container (see layout-display) - Columns: `grid-cols-{n}`, `grid-cols-none`, `grid-cols-subgrid`, `grid-cols-[...]` - Rows: `grid-rows-{n}`, `grid-rows-[...]` - Gap: `gap-{n}`, `gap-x-{n}`, `gap-y-{n}` - Placement: `col-span-{n}`, `col-start-{n}`, `row-span-{n}`, `row-start-{n}` - `col-span-full` / `row-span-full` - span all - `place-items-*` - shorthand for align + justify - Use `grid-cols-[...]` for custom templates like `minmax()` or `repeat()`