I want to have my layout to be 5 columns wide but only on xl screens and above. For large screens I want 4 columns and also 4 for medium and 2 for small/extra small.
Currently I have :
<div class="row mb-5">
{% for item in foobar %}
<div class="col-6 col-md-3 col-xl-2 py-2">
/* Content Here */
</div>
{% endfor %}
</div>
This is what I have managed so far. It works for all screen sizes except the xl screens where I would like 5 columns but I am getting 6.
Clearly 12 is not divisible by 5 so I am not sure how to achieve what I want.
What I have attempted to solve the problem:
I tried adding row-cols-xl-5 to the row class after researching some other stack exchange answers but that did not have an effect. Also I tried adding <div class="col offset1-xl"></div> before my divs that contain the content and whilst it did give me 5 cols this was applying on all screen sizes and made adjacent rows not line up properly and was giving weird spacing.
How is the easiest/best way to do this?
I know there is a similar problem on stackexchange already but that is different as it is about getting 5 columns but makes no reference to screen size, I want it to be responsive so only 5 columns on certain size screens!