JSFiddle - React, Tailwind, and code Playground
HTML
<div id="MyContainer0" class="MyContainer"></div>
<div id="MyContainer1" class="MyContainer"></div>
CSS
.MyContainer
{
height: 300px;
width: 300px;
position: relative;
overflow: auto;
background-color: silver;
margin-bottom: 15px;
}
.MyBlocks
{
position: absolute;
height: 50px;
width: 50px;
background-color: blue;
}
JavaScript
function LoadMe(iContainer)
{
var oMyContainer = document.getElementById("MyContainer" + iContainer);
var iRand = 50 + iContainer; //Math.floor(Math.random()*40) +
var oElem;
var iXVal, iYVal;
for (var iLup = 0; iLup < iRand; iLup++)
{
iYVal = (iLup * 60);
iXVal = 50;
oElem = document.createElement("DIV");
oElem.className = "MyBlocks";
oElem.style.transform = "translate3d(" + iXVal + "px, " + iYVal + "px , 0)";
oElem.style.msTransform = "translate3d(" + iXVal + "px, " + iYVal + "px , 0)";
oMyContainer.appendChild(oElem);
}
}
LoadMe(0);
LoadMe(1);