Nearby lessons
32 of 61🔲 Tailwind CSS - Grid (Template, Auto Flow, Columns & Rows)
📖 Grid Overview
CSS Grid Layout is a powerful two-dimensional layout system. Tailwind provides utilities for defining grid templates, controlling auto placement, and spanning items across columns and rows.
📐 Grid Template Columns
Control the number and size of grid columns:
grid-cols-1throughgrid-cols-12– Fixed column countgrid-cols-none– No grid columnsgrid-cols-subgrid– Subgrid (Tailwind v3.4+)- Arbitrary:
grid-cols-[200px_1fr]
📐 Grid Column Start / End
Control how items span across columns:
col-span-{n}– Span n columns (1–12, full)col-start-{n}– Start at column line n (1–13, auto)col-end-{n}– End at column line n (1–13, auto)
📐 Grid Template Rows
Control the number and size of grid rows:
grid-rows-1throughgrid-rows-6– Fixed row countgrid-rows-none– No explicit rows- Arbitrary:
grid-rows-[100px_1fr]
📐 Grid Row Start / End
Control how items span across rows:
row-span-{n}– Span n rows (1–6, full)row-start-{n}– Start at row line n (1–7, auto)row-end-{n}– End at row line n (1–7, auto)
📐 Grid Auto Flow, Columns & Rows
Grid Auto Flow controls how auto-placed items fill the grid:
grid-flow-row– Fill row by row (default)grid-flow-col– Fill column by columngrid-flow-dense– Fill gaps with smaller itemsgrid-flow-row-dense/grid-flow-col-dense
Grid Auto Columns – Size of implicitly created columns:
auto-cols-auto,auto-cols-min,auto-cols-max,auto-cols-fr
Grid Auto Rows – Size of implicitly created rows:
auto-rows-auto,auto-rows-min,auto-rows-max,auto-rows-fr
🧠 Test Your Knowledge
4 QuestionsProgress: 0 / 4
Keep Going!Tailwind CSS - Gap