JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
CSS
#container { border: 1px black solid; width:200px; height:200px; }
#container > div { width:50px; height:50px; float:left; background-color:black; }
#container > div:nth-child(4n+1) { clear:both; }
JavaScript
$("div:nth-child(8n+2), div:nth-child(8n+4), div:nth-child(8n+5), div:nth-child(8n+7)")
.css({"background-color":"white"});