Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS gap property

CSS gap property

Example

Set the gap between grid rows and columns:

.grid-container

{

gap:

50

px

;

}

Try it »


Browser support

The numbers in the table indicate the first browser version that supports this property.

property
gap (in multi-column) 66 16 61 Not supported 53
gap (in grid) 66 16 61 10.1 53
gap (in flexbox) 84 84 63 Not supported 70

Property definition and usage

The gap property is used to set the gap between grid rows and columns; it is a shorthand for row-gap and column-gap.

Note: CSS grid layout was originally defined with the grid-gap property, which is now 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:

20

px

50

px

;

}

Try it »


Related Articles

CSS Tutorial: CSS Grid Layout

CSS Reference Manual: row-gap property

CSS Reference Manual: column-gap property