JSFiddle - React, Tailwind, and code Playground

by mpartarrieu

HTML

<div id="row">
    <div class="col">COL1</div>
    <div class="col">COL2 Text added to this column so height is different</div>
    <div class="col">COL3</div>
    <div class="col">COL4</div>
    <div class="col">COL5</div>
    <div class="col">COL6</div>
    <div class="col">COL7</div>
    <div class="col">COL8</div>
    <div class="col">COL9</div>
    <div class="col">COL10</div>
    <div class="col">COL11</div>
    <div class="col">COL12</div>
    <div class="col">COL13</div>
</div>

CSS

#row {
    float:left;
    border:1px solid red;
}

.col { float:left;
width:30%; border:1px solid black; margin:1%;}

@media screen and (min-width: 401px) {
    #row .col:nth-child(3n+1) {  
        clear: left;
    }
}

@media screen and (max-width: 400px) {
    .col {width:45%;}
    #row .col:nth-child(2n+1) {  
        clear: left;
    }

}