JSFiddle - React, Tailwind, and code Playground
HTML
<div>1st</div>
<div class="longone">2nd</div>
<div>3rd</div>
<div>4th</div>
<div class="longone">5th</div>
<div class="shortone">6th</div>
<div>7th</div>
<a href="#">Apply selector</a>
CSS
div {border:1px red solid;float: left;height:80px; width:30%;}
div.longone {height: 160px;}
div.shortone {height: 40px;}
a {clear:both;display:block;}
JavaScript
$('a').click(function() {
$('<div/>').css({
'width': '100%',
'clear': 'both',
'height': '0',
'border': '0'
}).insertAfter('div:nth-child(3n)');
});