Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

CSS Dictionary

  1. Home
  2. CSS Dictionary
  3. row-gap

row-gap

Specifies the spacing between items in the row direction (cross-axis direction) within a flex container or grid container.

Sample Code

/* Specify row spacing as 20px */
.container {
    display: flex;
    flex-wrap: wrap;
    row-gap: 20px;
}

/* Used in combination with column-gap */
.container-combo {
    display: flex;
    flex-wrap: wrap;
    row-gap: 32px;
    column-gap: 16px;
}

Available Values

ValueDescription
normalThe initial value. In Flexbox, this is equivalent to 0.
<length>Specifies the spacing using length values such as px, em, rem, etc.
<percentage>Specifies the spacing as a percentage relative to the container's size.

Specification

ItemDetails
Initial valuenormal
Applies toFlex containers, grid containers, and multi-column containers
InheritedNo
AnimationPossible (interpolated as length/percentage)

Browser Compatibility

Chrome Chrome
47+
46 and earlier ×
Firefox Firefox
52+
51 and earlier ×
Safari Safari
10.1+
9 and earlier ×
Edge Edge
16+
Supported in all versions
IE IE
11 ×
10 ×
9 ×
8 ×
7 ×
6 ×
Opera Opera
34+
33 and earlier ×
iOS Safari iOS Safari
10.3+
9 and earlier ×
Android Android Browser
47+
46 and earlier ×
Chrome Android Chrome Android
Latest
Same support as desktop
Firefox Android Firefox Android
Latest
Same support as desktop

※ Version data is based on MDN / Can I Use.

Details

A B C D E row-gap

'row-gap' is a property that specifies the spacing between items in the row direction. When 'flex-direction: row' and 'flex-wrap: wrap', it controls the spacing between rows that result from line wrapping. Use it when you want to adjust only the row spacing independently of 'column-gap'.

Differences from 'gap'

When setting the same value for both row and column spacing, a single 'gap' property suffices. When you want to set different values for row and column spacing, write 'gap: row-spacing column-spacing;' or specify 'row-gap' and 'column-gap' individually.

/* The following two are equivalent */
.container-a { gap: 32px 16px;}
.container-b { row-gap: 32px; column-gap: 16px;}

Related Properties

PropertyDescription
column-gapSpecifies the spacing in the column direction (main axis direction).
gapShorthand for specifying both 'row-gap' and 'column-gap' at once.

If you find any errors or copyright issues, please .