gap between flex elements code example
Example 1: css flex gap between items
/* limited support (Q1/2021: Firefox, Chrome, Safari) */
.flex-container
{
display: flex;
gap: 5px;
}
/* broad support */
.flex-item
{
margin: 5px;
/* and/or */
padding: 5px;
}
Example 2: add space between flex items
.flex-gap {
display: inline-flex;
flex-wrap: wrap;
}
.flex-gap > div {
margin: 6px; /* HERE WE ADD THE SPACE */
}