margin in felxbox code example
Example 1: add space between all html elements flex
/* There is now a `gap` CSS property
** This works for , , and layouts
** #box{} would lay out all it's children with 10px spacing between
** different rows and 20px betwen different columns
*/
#box {
display: flex;
flex-wrap: wrap;
gap: 10px 20px; /* row-gap [column-gap]*/
}
/* Supported by most modern browesers, Safari excluded. */
Example 2: gap between two flex items
.upper
{
margin:30px;
display:flex;
flex-direction:row;
width:300px;
height:80px;
border:1px red solid;
padding:5px; /* this */
}
.upper > div
{
flex:1 1 auto;
border:1px red solid;
text-align:center;
margin:5px; /* and that, will result in a 10px gap */
}
.upper.mc /* multicol test */
{flex-direction:column;flex-wrap:wrap;width:200px;height:200px;}