CSS - grid-row-gap

The grid-row-gap CSS property specifies the gutter between grid rows.



HTML Content

<div id="grid">

CSS Content

#grid {
  display: grid;
  height: 200px;
  grid-template-columns: 200px;
  grid-template-rows: repeat(3, 1fr);
  grid-row-gap: 20px;

#grid > div {
  background-color: lime;


/* <length> values */
grid-row-gap: 20px;
grid-row-gap: 1em;
grid-row-gap: 3vmin;
grid-row-gap: 0.5cm;

/* <percentage> value */
grid-row-gap: 10%;

/* Global values */
grid-row-gap: inherit;
grid-row-gap: initial;
grid-row-gap: unset;


Is the width of the gutter separating the grid lines.
Is the width of the gutter separating the grid lines, relative to the dimension of the element.

Formal syntax

<a href="css/grid-row-gap#length-percentage"><length-percentage></a><p>where <br><code><length-percentage> = <a title="Possible values: a number followed by'em', 'ex', 'ch', 'rem', 'px', 'cm', 'mm', 'in', 'vh', 'vw', 'vmin', 'vmax', 'pt', 'pc' or 'px', like 3px, 1.5cm, -0.5em or 0" href="css/length"><length></a> <a title="Single bar" href="css/value_definition_syntax#single_bar">|</a> <a title="" href="css/percentage"><percentage></a></code></p>


The grid-row-gap CSS property specifies the gutter between grid rows.

The effect is as though the affected grid lines acquired width: the grid track between two grid lines is the space between the gutters that represent them. For the purpose of track sizing, each gutter is essentially treated as an extra track of the specified length. Negative values are invalid.

Initial value0
Applies togrid containers
Percentagesyes, as the dimension of the element
Computed valuethe percentage as specified or the absolute length
Animatableyes, as a length
Canonical orderthe unique non-ambiguous order defined by the formal grammar

Browser Compatibility  

Feature Chrome Firefox (Gecko) Internet Explorer Edge Opera Safari
Basic support 29.0[1] 40.0 (40.0)[2] No support[3] No support[3] 28.0[1] Nightly build-webkit
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support No support No support[3] No support No support

[1] Implemented behind the experimental Web Platform features flag in chrome://flags.

[2] Implemented behind the preference layout.css.grid.enabled, defaulting to false.

[3] Internet Explorer implements an older version of the specification, which didn't define this property.

See Also  


Specification Status Comment
CSS Grid Layout
The definition of 'grid-row-gap' in that specification.
Working Draft Initial definition


© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.

CSS CSS Grid CSS Property Reference