[css] Better way to set distance between flexbox items

You can use & > * + * as a selector to emulate a flex-gap (for a single line):

_x000D_
_x000D_
#box { display: flex; width: 230px; outline: 1px solid blue; }_x000D_
.item { background: gray; width: 50px; height: 100px; }_x000D_
_x000D_
/* ----- Flexbox gap: ----- */_x000D_
_x000D_
#box > * + * {_x000D_
  margin-left: 10px;_x000D_
}
_x000D_
<div id='box'>_x000D_
    <div class='item'></div>_x000D_
    <div class='item'></div>_x000D_
    <div class='item'></div>_x000D_
    <div class='item'></div>_x000D_
</div>
_x000D_
_x000D_
_x000D_

If you need to support flex wrapping, you can use a wrapper element:

_x000D_
_x000D_
.flex { display: flex; flex-wrap: wrap;  }_x000D_
.box { background: gray; height: 100px; min-width: 100px; flex: auto; }_x000D_
.flex-wrapper {outline: 1px solid red; }_x000D_
_x000D_
/* ----- Flex gap 10px: ----- */_x000D_
_x000D_
.flex > * {_x000D_
  margin: 5px;_x000D_
}_x000D_
.flex {_x000D_
  margin: -5px;_x000D_
}_x000D_
.flex-wrapper {_x000D_
  width: 400px; /* optional */_x000D_
  overflow: hidden; /* optional */_x000D_
}
_x000D_
<div class='flex-wrapper'>_x000D_
  <div class='flex'>_x000D_
    <div class='box'></div>_x000D_
    <div class='box'></div>_x000D_
    <div class='box'></div>_x000D_
    <div class='box'></div>_x000D_
    <div class='box'></div>_x000D_
  </div>_x000D_
</div>
_x000D_
_x000D_
_x000D_