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.
The row-gap
property specifies the gap between the rows in a flexbox or grid layout.
The row-gap
property was formerly known as grid-row-gap
.
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 |
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 |
row-gap:
length|normal|initial|inherit;
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 |
Set the gap between rows to 70px in a flexbox layout:
#flex-container {
display: flex;
row-gap: 70px;
}
Try it Yourself »
CSS Tutorial: CSS Grid Layout
CSS Tutorial: CSS Flexbox Layout
CSS Reference: gap property
CSS Reference: column-gap property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!