← All notes

CSS Grid: two-dimensional layout in rows and columns

Answer: CSS Grid is a layout method designed for two-dimensional content, in rows and columns at the same time. Flexbox lays out in one dimension, and there is synergy when using the two together.

What grid adds

Grid is a layout method designed for two-dimensional content. That means laying things out in rows and columns at the same time.

You first define the rows and columns. Items can be placed by you, or the browser can auto-place them into the cells.

Direct children of the grid container will be automatically placed onto this grid.

The grid is made of lines that run horizontally and vertically. Numbering starts from 1.

Grid and Flexbox

Flexbox made a lot of complex layout tasks easier, but screens commonly have a second dimension.

Grid arranges in two dimensions. Flexbox lays out in one dimension. There is synergy when using the two together.

Despite the similarities in concept and syntax, do not think of them as competing layout techniques.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: web.dev, CSS Grid layout; Chrome Developers, Getting started with CSS Grid. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-4.0 (https://developers.google.com/site-policies). Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License. Copyright Google LLC. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: web.dev, CSS Grid layout; Chrome Developers, Getting started with CSS Grid. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-4.0 (https://developers.google.com/site-policies). Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License. Copyright Google LLC.

Cite this

Permanent ID: iil:note:11sph954

iinventedlight. 2026. "CSS Grid: two-dimensional layout in rows and columns." iinventedlight Library, iil:note:11sph954, version of 2026-11-23. https://iinventedlight.com/library/notes/css-grid-basics/. License: CC-BY-4.0.

@misc{iil_note_11sph954,
  author = {{iinventedlight}},
  title = {{CSS Grid: two-dimensional layout in rows and columns}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-23},
  url = {https://iinventedlight.com/library/notes/css-grid-basics/},
  note = {Permanent ID iil:note:11sph954. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/css-grid-basics.md.