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

CSS grid-gap property

CSS grid-gap property

Example

Set the row and column gaps to 50px:

.grid-container

{

grid-gap:

50

px

;

}

Try it »


Browser support

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

property
grid-gap 57 16 52 10 44

Property definition and usage

The grid-gap property is used to set the gaps between grid rows and columns.

Note: grid-gap is the shorthand for row-gap and column-gap.

Default value: 0 0
Inherited: no
Animatable: support. Read about animatable Try it
Version: CSS Grid Layout Module Level 1
JavaScript syntax: object.style.gridGap="50px 100px" Try it

Syntax

grid-gap: grid-row-gap grid-column-gap;

Value Description
grid-row-gap Sets the gap size between rows in the grid layout. The default value is 0.
grid-column-gap Sets the gap size between columns in the grid layout. The default value is 0.

Example

The following example sets the grid row gap to 20px and the column gap to 50px:

.grid-container

{

grid-gap:

20

px

50

px

;

}

Try it »


Related Articles

CSS Tutorial: CSS Grid Layout

CSS Reference Manual: grid-row-gap property

CSS Reference Manual: grid-column-gap property