CSS gapProperty
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
| Property | |||||
|---|---|---|---|---|---|
| gap (in multi-column) | 66 | 16 | 61 | Not supported | 53 |
| gap (in grid) | 66 | 16 | 61 | 10.1 | 53 |
| gap (flexbox) | 84 | 84 | 63 | Not supported | 70 |
Property definition and usage instructions
The gap property is used to set the gaps between grid rows and columns, and is a shorthand for row-gap and column-gap.
Note:CSS Grid Layout was initially defined using the grid-gap property, which is gradually being replaced by gap.
| Default Value: | normal normal |
|---|---|
| Inherited: | no |
| version: | CSS3 |
| JavaScript Syntax: | object.style.gap="50px 100px" |
Syntax
gap: row-gap column-gap;
| Value | Description |
|---|---|
| row-gap | Sets the size of the gap between rows in a grid layout. |
| column-gap | Sets the size of the gap between columns in a grid layout. |
More Examples
Example
Set the row gap to 20px and the column gap to 50px:
.grid-container {
gap: 20px 50px;
}
Try it Yourself »
Related Articles
CSS Tutorial:CSS Grid Layout
CSS Reference Manual:row-gapProperty
CSS Reference Manual:column-gapProperty
other extensions