CSS Grid Columns, Rows and Gaps
CSS Grid Columns
The vertical lines of grid items are called columns.

Grid Rows
The horizontal lines of grid items are called rows.

Grid Gaps
The spaces between each column/row are called gaps.

You can adjust the gap size by using one of the following properties:
The CSS column-gap Property
The column-gap
property specifies the gap
between the columns in a grid.
Example
Specify a 50 pixels gap between the columns in the grid:
.container {
display: grid;
column-gap: 50px;
}
Result:
The CSS row-gap Property
The row-gap
property specifies the gap
between the rows in a grid.
Example
Specify a 50 pixels gap between the rows in the grid:
.container {
display: grid;
row-gap: 50px;
}
Result:
The CSS gap Property
The gap
property is a shorthand property for
row-gap
and
column-gap
:
Example
Set the gap between rows to 50px, and the gap between columns to 100px in the grid:
.container {
display: grid;
gap: 50px 100px;
}
Result:
Example
Set the gap between rows and the columns to 50px in the grid:
.container {
display: grid;
gap: 50px;
}
Result:
All CSS Grid Column, Row and Gap Properties
Property | Description |
---|---|
display | Specifies the display behavior (the type of rendering box) of an element |
column-gap | Specifies the gap between the columns |
gap | A shorthand property for the row-gap and the column-gap properties |
row-gap | Specifies the gap between the grid rows |