Content alignment

Properties that control how rows and columns are distributed inside the grid container.
  • justify-content: distributes columns horizontally inside the grid.
  • align-content: distributes rows vertically inside the grid.
  • place-content: shorthand to combine justify-content and align-content.
  • Possible values:
  • stretch: Stretches rows/columns to fill all available space (default).
  • start: Aligns the whole grid to the start of the axis (top or left).
  • center: Centers the grid along the axis.
  • end: Places all rows/columns at the end of the axis (bottom or right).
  • space-around: Distributes space leaving equal margins around each row or column group (edges have half the space of the interior).
  • space-between: Distributes rows/columns so the first and last are flush with the edges, and space is distributed only between them.
  • space-evenly: Places perfectly equal spaces between all rows/columns and also at the edges.

Example

In this dynamic example, we can see the different row and column alignments using justify-content and align-content.

Select justify-content:
Select align-content:
ResultLive
html
css