The <grid-gap>, along with <row-gap> and <column-gap> properties, controls spacing between grid layouts. With these, we can separate elements easily without using extra margins.
The <grid-gap> property is shorthand for setting both row and column spacing. This is a simple way to make a grid neat and readable.
The following example shows how to create a two-column grid with 20px spacing between cells.
The <row-gap> and <column-gap> properties allow us to set row and column spacing independently. This is useful when aiming for different layouts.
In this example, the row spacing is 10px, while the column spacing is 30px.
Setting spacing improves the website’s visual structure and user experience. Here are some useful tips:
Please sign in to ask Lara about CSS grid-gap.
Select Language
Set theme
© 2025 ReadyTools. All rights reserved.