My goal is to create a responsive layout with x columns that display 3 columns per row on lg
screen sizes, aligned using justify-content-between
. When the screen size is smaller than lg
, all x columns should stack vertically and be aligned using justify-content-center
.
The key factor I am keeping in mind is that the surrounding column divs need to be the same, allowing me to easily switch column 7 with column 3 without making individual changes to each column div.
This is what I have so far:
<div class="d-flex justify-content-between">
<div class="col-lg">
<div style="width: 288px;" class="justify-content-center bg-primary">col 1</div>
</div>
<div class="col-lg">
<div style="width: 288px;" class="justify-content-center bg-secondary">col 2</div>
</div>
<div class="col-lg">
<div style="width: 288px;" class="justify-content-center bg-warning">col 3</div>
</div>
<div class="col-lg">
<div style="width: 288px;" class="justify-content-center bg-primary">col 4</div>
</div>
<div class="col-lg">
<div style="width: 288px;" class="justify-content-center bg-secondary">col 5</div>
</div>
<div class="col-lg">
<div style="width: 288px;" class="justify-content-center bg-warning">col 6</div>
</div>
</div>
I'm encountering two main issues:
- When wrapping the columns in a
.col
, it disruptsjustify-content-between
- Columns 4, 5, and 6 are not automatically moving to the next row as expected
Any assistance would be greatly appreciated!