Give top the pseudo element the same properties that you are giving the elements, but a height very low.
But if more than 2 pseudo element are needed, you need another technique
.parent {
background: red;
max-width: 500px;
height: 400px;
display: flex;
flex-wrap: wrap;
}
.parent::after {
content: '';
flex: 130px 1;
margin: 10px;
background-color: yellow;
height: 10px;
}
.child {
background: blue;
margin: 10px;
flex: 130px 1;
color: #FFFFFF;
text-align: center;
line-height: 50px;
font-size: 60px;
}
<div class="parent">
<div class="child">1</div>
<div class="child">2</div>
<div class="child">3</div>
<div class="child">4</div>
<div class="child">5</div>
<div class="child">6</div>
<div class="child">7</div>
<div class="child">8</div>
</div>
Note that the real height for the pseudo would be 0px, and the background yellow wouldn't be there...
Those are just for demo purposes
Edit: FF handles different the situation where the minimun height comes from min-height and the situation where it comes from flex-basis. But Chrome handles those just the same. So my previous solution worked only for Chrome. (Don't know for sure which is "standard".
I changed the min-height of .child and moved it to flex-basis, now it works ok both in Chrome and FF.