I have a bunch of divs on my page, I need to render it such a way so that they are displayed in 4 columns and all four centered to the parent div.
Can it be done in JS code? Is it possible only to do it css? Which one is recommended?
Here's what i have done so far : Fiddle DEMO
$(document).ready(function () {
var listItems = $(".item");
listItems.each(function (index, value) {
if (index % 4 == 0) {
// what should i do here?
}
});
});