Who knows how in Flex to customize the display of elements under each other?

Good day, I need to configure the display units inside of Flex, so they adjoined each other with no gaps:

Elements as in the example will be of different heights, as in the example a maximum of 5 in a row then the next row, then the next, etc. the Problem is that whatever settings align-items and align-content has not applied, is still not out as I need. How to be here, someone tell me?

April 19th 20 at 12:10
2 answers
April 19th 20 at 12:12
Google masonry
Flex will not help here
April 19th 20 at 12:14
Much easier like structures to create CSS based Grid.

For example:

Or use masonry, Grid CSS although in my opinion better.
Grid, not too crossbrowser - Leopoldo commented on April 19th 20 at 12:17
@Leopoldo, well, it's a matter of choice. - Carmen.Murazik commented on April 19th 20 at 12:20

Find more questions by tags FlexboxHTMLCSS