CSS Grid

A CSS layout mode that places a container's children into rows and columns.

In more detail

Like flexbox, grid only positions direct children, so wrapper elements get in the way. Do not confuse it with the 8-point spacing grid, which is a spacing rule rather than a CSS feature.

Example

In the browser: You define tracks with grid-template-columns and grid-template-rows, optionally name regions with grid-template-areas, and place items into them. Flexbox handles one direction; grid handles both, and the two are often combined.

Related terms

Taught in

References