CSS row-gap Property
Example
Specify a 50 pixels gap between the grid rows:
#grid-container
{
display: grid;
row-gap: 50px;
}
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The row-gap
property specifies the gap between the rows in a flexbox or grid layout.
Default value: | normal |
---|---|
Inherited: | no |
Animatable: | yes. Read about animatable Try it |
Version: | CSS Box Alignment Module Level 3 |
JavaScript syntax: | object.style.rowGap="50px" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
row-gap (in Grid) | 66 | 16 | 61 | 12 | 53 |
row-gap (in Flexbox) | 84 | 84 | 63 | 14.1 | 70 |
CSS Syntax
row-gap: length|normal|initial|inherit;
Property Values
Value | Description | Demo |
---|---|---|
length | A specified length or % that will set the gap between the rows | Demo ❯ |
normal | Default value. Specifies a normal gap between the rows | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
More Examples
Flexbox layout
Set the gap between rows to 70px in a flexbox layout:
#flex-container {
display: flex;
row-gap: 70px;
}
Try it Yourself »
Related Pages
CSS Tutorial: CSS Grid Layout
CSS Tutorial: CSS Flexbox Layout
CSS Reference: gap property
CSS Reference: column-gap property