JSFiddle - React, Tailwind, and code Playground

by 3rror404

HTML

<div class="wrap">
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
</div>
<hr> 
<div class="wrap">
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
</div>
<hr> 
<div class="wrap">
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
</div>
<hr> 
<div class="wrap">
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
</div>
<hr>        
<div class="wrap">
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
</div>
<hr>       
<div class="wrap">
    <div><img src="http://placehold.it/100x100"></div>
    <div><img src="http://placehold.it/100x100"></div>
</div>
<hr>        
<div class="wrap">
    <div><img src="http://placehold.it/100x100"></div>
</div>

CSS

hr {
    margin: 20px 0;
}

.wrap {
    display: flex;
    flex-wrap: wrap;
}

.wrap div {
    flex-grow: 1;
    
    min-width: 33.33%;
    
}

.wrap div:nth-child(3n+4),
.wrap div:nth-child(3n+5){
    width: 33.33%;
    flex-grow: 0;
}

.wrap div img {
    width: 100%;
}