
CSS Grid Tutorial: Build a Responsive Layout Step by Step
CSS Grid is a two-dimensional layout system for building rows and columns at once.
Layout used to mean floats, clearfixes, and hacks. Flexbox and CSS Grid replaced all of that with two purpose-built systems, and knowing which to reach for is half the battle. Here we build layouts step by step: centering, columns, responsive grids, and the alignment properties that finally make sense once you see them in action.

CSS Grid is a two-dimensional layout system for building rows and columns at once.

Flexbox is a one-dimensional CSS layout system for arranging items along a single axis.

Use Flexbox for one-dimensional layouts (a single row or column) like navbars, toolbars, and the inside of cards, where content drives the spacing.

To center a div horizontally and vertically, set its parent to display: flex, then add justify-content: center and align-items: center.