You can use space-between with pseudo elements from the parent
.flex {
display: flex;
width: 500px;
border: 1px solid black;
justify-content: space-between;
}
.flex > div {
background: #eee;
border: 1px solid #aaa;
height: 100px; width: 100px;
}
.flex:before,.flex:after {
content: '';
}