I've searched extensively for a solution to my unique problem, but haven't been able to find one that fits. I have 4 div boxes with a max width of 50% and a min width of 400px. When the site is viewed on a smaller screen, I want the boxes to align vertically rather than horizontally. However, I'm struggling to center the boxes in this vertical alignment.
I've tried using
display: table; margin: 0 auto;
but it hasn't worked. I also attempted wrapping everything in another div and experimenting with different width values like max-content, min-content, auto, and fit-content, but none of these solutions have been successful. Does anyone have an easy workaround?
Here's a simplified version of my issue:
.format {
width: 50%;
float: left;
height: auto;
min-width: 500px;
background-color: lightblue;
display: table;
margin: 0 auto;
}
<div class="format">
<p>Head Coach</p>
</div>
<div class="format">
<p>Under 17</p>
</div>
<div class="format">
<p>Under 15</p>
</div>
<div class="format">
<p>Others</p>
</div>
Apologies for any language errors in my message. Hopefully, it was still understandable :)