I am facing an issue with a foreach statement in jQuery where I am generating Bootstrap cards for each product in a list. The problem arises when attempting to create multiple cards in a row, as the width of the cards becomes too small for the content.
I am trying to achieve a layout where if there are 3 cards in a row like this:
| div | div | div |
The 4th card should automatically move underneath the first card, like this:
| div | div | div |
| div |
However, I have been unable to find a solution to achieve this. I believe it can be done using the grid system in Bootstrap, but I have been unsuccessful in implementing it.
Below is the code snippet I am working with:
<div class="row justify-content-md-center">
<div class="col-12">
<table class="table table-striped">
<div id="card-deck" class="card-deck">
//foreach loop here
</div>
</table>
</div>
</div>