might be best explain with an example (using bootstrap grid)
Thanks in advance for the assistance
1 item in list
<div class="container">
<div class="row">
<div class="col-sm-12">item 1</div>
</div>
</div>
2 items in list
<div class="container">
<div class="row">
<div class="col-sm-6">item 1</div>
<div class="col-sm-6">item 2</div>
</div>
</div>
3 items in list
<div class="container">
<div class="row">
<div class="col-sm-4">item 1</div>
<div class="col-sm-4">item 2</div>
<div class="col-sm-4">item 3</div>
</div>
</div>
4+ items in list, same as 3 items in list except new rows are created
- 4 items / 3 = 2 rows are used
- 8 items / 3 = 3 rows are used
2
Answers
The question has little to do with JavaScript. This is a problem that can be quickly overcome with a CSS crash course. The puzzlement arises from your insistence on the "row". Incorrect approach. The correct approach is to create a grid container, specifying that 1 row can contain a maximum of 3 items. If you insert, for example, 7 children into it, there will be 2 complete rows and 1 started row. Let me demonstrate.
The width of 1fr means that each item should have the same width. The number 3 preceding it signifies the quantity of items in the repeat() function.
Example