Flexbox gap
The gap CSS property in a flexbox layout sets the size of the space between items.
Overview
The gap CSS property in a flexbox layout sets the size of the space between items.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
css.properties.column-gap.flex_context | 84 | 84 | 63 | 14.1 | 84 | 14.5 |
| CSS property | ||||||
flex context Supported in Flex Layout | 84 | 84 | 63 | 14.1 | 84 | 14.5 |
flex context Supported in Flex Layout | 84 | 84 | 63 | 14.1 | 84 | 14.5 |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Syntax
CSS
.flex-container {
display: flex;
flex-wrap: wrap;
gap: 1rem;
/* You can also specify row-gap and column-gap separately */
/* row-gap: 1rem; */
/* column-gap: 2rem; */
} Live demo
Row-gap and column-gap. separated
vertical and horizontal in by. margin use, info. and strongpattern.
PreviewFullscreen
Margin knot-main. button column
childelement to margin, parent. Gap only in marginmanage completetie.
PreviewFullscreen
Use cases
Using Flexbox gap
The gap CSS property in a flexbox layout sets the size of the space between items.
Cautions
- May not be supported in older browsers.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.
Related links
Powered by web-features