Master CSS Grid with visual examples. Learn grid-template-columns, grid-template-rows, grid-area, and all essential properties.
CSS Grid is the most powerful layout system in CSS. It provides a two-dimensional grid system that handles both columns and rows.
| Property | Purpose | Example |
|---|---|---|
| display | Enable grid | display: grid |
| grid-template-columns | Define columns | 1fr 2fr 1fr |
| grid-template-rows | Define rows | auto 1fr auto |
| gap | Spacing | 1rem |
| grid-area | Place items by name | header / main |
Use auto-fill and minmax: grid-template-columns: repeat(auto-fill, minmax(250px, 1fr))
Use grid-template-areas to define header, sidebar, main, and footer regions.