Closed Ly900 closed 9 years ago
I am dynamically adding divs to a div container and I want each little imageDiv added to take up 25% of the width of its parent container. Current code:
#cardsContainer { margin: 0 auto; border: 2px solid black; width: 90%; padding: 0; } .imageDiv { width: 25%; margin: 0; padding: 0; border: 1px solid black; display: inline-block; }
$.each(allCards, function (index, value) { var imageDiv = $("<div class='imageDiv'>hi<img></img></div>"); $(imageDiv).appendTo($("#cardsContainer")); // $("imageDiv").find("img").attr("src", value).appendTo("#cardsContainer"); })
I am dynamically adding divs to a div container and I want each little imageDiv added to take up 25% of the width of its parent container. Current code: