We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

row-gap

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

CSS Grid Layout initially defined the grid-row-gap property. This prefixed property will be replaced by row-gap, however in order to support browsers that implemented grid-row-gap and not row-gap for grid, you will need to use the prefixed property as in the interactive example above.

Syntax

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

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

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

Values

<length-percentage>
Is the width of the gutter separating the rows. <percentage> values are relative to the dimension of the element.

Formal syntax

normal | <length-percentage>

where
<length-percentage> = <length> | <percentage>

Example

HTML Content

<div id="grid">
  <div></div>
  <div></div>
  <div></div>
</div>

CSS Content

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

#grid > div {
  background-color: lime;
}

 

Specifications

Specification Status Comment
CSS Box Alignment Module Level 3
The definition of 'row-gap' in that specification.
Working Draft Initial definition

Initial valuenormal
Applies tomulti-column elements, flex containers, grid containers
Inheritedno
Percentagesrefer to corresponding dimension of the content area
Mediavisual
Computed valueas specified, with <length>s made absolute, and normal computing to zero except on multi-column elements
Animation typea length, percentage or calc();
Canonical orderper grammar

Browser compatibility

No compatibility data found. Please contribute data for "css.properties.row-gap" (depth: 1) to the MDN compatibility data repository.

See also

Document Tags and Contributors

Contributors to this page: rachelandrew
Last updated by: rachelandrew,