JSFiddle - React, Tailwind, and code Playground
by Vitaliy
CSS
body{
display: flex;
flex-wrap:wrap;
}
JavaScript
var imgs =[
'http://r.ddmcdn.com/s_f/o_1/cx_0/cy_0/cw_300/ch_300/w_300/APL/uploads/2014/10/kitten-cuteness300.jpg',
'http://catfriendly.com/wp-content/uploads/2016/10/tab-HERO-toybox_300x300_acf_cropped.jpg',
'http://images.meredith.com/content/dam/bhg/Images/2013/2/4/295212_3839391670148_668524905_n.jpg.rendition.largest.ss.jpg',
'http://images.meredith.com/content/dam/bhg/Images/2013/11/18/102171868.jpg.rendition.largest.ss.jpg',
'http://images.meredith.com/content/dam/bhg/Images/2013/2/14/100021590.jpg.rendition.largest.ss.jpg'
];
function render(container, images){
var shuffeled = images.sort(function(){
return Math.random() - 0.5;
});
shuffeled.forEach(function(item, index){
var img = document.createElement('IMG');
img.src = item;
img.title = 'image ' + index;
container.appendChild(img);
});
}
render(document.body, imgs);