← Cheat Sheets

CSS Grid Layout Properties

Container and item properties for Grid.

# CSS Grid Layout Properties

Container and item properties for Grid.

| Property | Example |
|---|---|
| Define columns | `grid-template-columns: 200px 1fr 1fr;` |
| Repeat | `repeat(3, 1fr)` |
| Responsive columns | `repeat(auto-fit, minmax(240px, 1fr))` |
| Rows | `grid-template-rows: auto 1fr auto;` |
| Gaps | `gap: 16px 24px;` (row, column) |
| Name areas | `grid-template-areas: "header header" "nav main";` |
| Place an item | `grid-column: 1 / 3;` or `grid-area: header;` |
| Span | `grid-column: span 2;` |
| Align all items | `place-items: center;` |
| Align the whole grid | `justify-content`, `align-content` |
| Auto placement | `grid-auto-flow: row dense;` |