flexbox gap between items code example
Example 1: css flex gap between items
.flex-container
{
display: flex;
gap: 5px;
}
.flex-item
{
margin: 5px;
padding: 5px;
}
Example 2: space between flexbox
justify-content: space-between;
Example 3: add space between flex items
.flex-gap {
display: inline-flex;
flex-wrap: wrap;
}
.flex-gap > div {
margin: 6px;
}
Example 4: gap between two flex items
.upper
{
margin:30px;
display:flex;
flex-direction:row;
width:300px;
height:80px;
border:1px red solid;
padding:5px;
}
.upper > div
{
flex:1 1 auto;
border:1px red solid;
text-align:center;
margin:5px;
}
.upper.mc
{flex-direction:column;flex-wrap:wrap;width:200px;height:200px;}