CSS gap property
Browser support · legacy reference
ChromeFully supports
SafariFully supports
FirefoxFully supports
Internet ExplorerFully supports
EdgeFully supports
OperaFully supports
Description
CSS gap property defines the distance between two columns or two rows. It is a shorthand property of row-gap and column-gap.
We take an example of a grid. And we'll see the gap between two rows or two columns.
Syntax
gap : row-gap column-gap
Property values
row-gap
+ve length
-
length value adds respective gap between the rows. The following demo represents 30px gap between the rows.
- Try it
row-gap: 30px; +ve percentage
-
percentage value adds respective gap between the rows. The following demo represents 30% gap between the rows.
- Try it
row-gap: 30%;
column-gap
Applicable to
It applies to flex containers, grid containers, and multi-column contaienrs.