JSFiddle - React, Tailwind, and code Playground
by stevebot25
HTML
<html>
<head></head>
<body></body>
</html>
CSS
.ellipsisMe {
white-space: nowrap;
overflow: hidden;
width: 20px;
}
JavaScript
var numberOfDivs = 10;
var t = "thisissomereallylongtextthatneedstogetellipsisputintoit";
for(var j = 0; j < numberOfDivs; j++){
var elem = document.createElement('div');
elem.className = "ellipsisMe";
elem.style = "width:10px;";
elem.innerHTML = t;
document.body.appendChild(elem);
}