gap
Widely availableSince 201797% of users
Sets the distance between rows and columns in grid, flex or multi-column layouts. It is a shorthand for row-gap and column-gap.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyClassic, with newer partsIt has worked everywhere since October 2017, and it keeps getting newer values.
Newer parts of gap
Supported in Flex LayoutBaseline Apr 2021, Widely Oct 2023Supported in Multi-column LayoutBaseline Apr 2021, Widely Oct 2023Supported in Grid LayoutBaseline Sept 2018, Widely Mar 2021
See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
See individual properties- Inherited
- No
- Applies to
- multi-column elements, flex containers, and grid containers
Quick example
.flex-container {
display: flex;
gap: 1.5rem;
/* sets equal gap between all flex items */
}
.grid-container {
display: grid;
gap: 20px 40px;
/* row-gap: 20px, column-gap: 40px */
}Values
row-gapcolumn-gapgap browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2017.Safe to use without fallbacks.
Usage97%of people can use this3% use a browser without it.
Browsers
57+
52+
10.1+
16+Mobile
57+Android
52+Android
10.3+iOS