CSS row-gap Property
Description
The row-gap property defines the amount of empty space inserted between successive row tracks in a layout. In practical terms it controls the vertical gutters that separate horizontal tracks created by a grid or by multi-line flex layouts; it only affects the spacing between rows, not the internal padding or margins of the grid/flex items themselves. Because the gap it creates sits between tracks, it does not change the intrinsic size of any individual item — it changes the distance the layout engine leaves between those items.
In a grid context, row-gap is applied between grid rows whether those rows are created explicitly (via something like grid-template-rows) or implicitly (auto-placed rows). The property influences the visual separation and can affect how content flows when you have fixed or flexible row track sizing: adding more gap increases the overall height of the grid’s content area even though individual row definitions remain the same. Gaps are part of the grid’s track sizing model and do not collapse with item margins, so you won’t get margin-collapsing behavior between rows.
When used with multi-line flex containers, row-gap takes effect only when the flex items wrap to form multiple lines (i.e., the flex container is using wrapping). In that case the value sets the spacing between flex lines rather than between individual items within the same line. For two-dimensional spacing it is commonly used alongside column-gap, or via the single shorthand gap, to separately control horizontal and vertical gutters.
Considerations when using row-gap include its interaction with backgrounds and alignment: backgrounds applied to the container will span across the gap while backgrounds on individual items will not, and alignment of items within rows is handled independently of the gap size. It is also useful for creating consistent vertical rhythm without having to manage per-item margins, and it works predictably across explicit and implicit rows so long as you account for the extra space it adds to the overall layout.
Definition
- Initial value
- normal
- Applies to
- multi-column elements, flex containers, grid containers
- Inherited
- no
- Computed value
- as specified, with <length>s made absolute, and normal computing to zero except on multi-column elements
- Animatable
- a length, percentage or calc();
- JavaScript syntax
- object.style.rowGap
Interactive Demo
Syntax
row-gap: normal | <length>
Values
- normalDefault value. Specifies a normal gap between the rows
- <length>Is the width of the gutter separating the rows. <percentage> values are relative to the dimension of the element.
Example
Browser Support
The following information will show you the current browser support for the CSS row-gap property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
