JSFiddle - React, Tailwind, and code Playground
CSS
.sorted {
background-color: rgb(0, 160, 248);
padding: 5px;
position: absolute;
opacity: .7;
font-family: georgia, serif;
}
JavaScript
var sort = function( arr )
{
for( var key in arr )
{
var module = document.createElement( 'div' );
module.className = 'sorted';
module.style.left = arr[ key ] * 100 / (Math.max.apply( null, arr )*1.1) + "%";
var text = document.createTextNode( arr[ key ] );
module.appendChild( text );
document.body.appendChild( module );
}
};
sort([60, 20, 230, 100, 300]);