I'm struggling to align an array of buttons with varying lengths so that the center of each button lines up with the button below it. I've attempted several solutions, thinking that using justify-content-around
would be the solution, but it hasn't worked as expected. I also tried using mx-auto, but that didn't solve the issue either.
<div class="d-flex justify-content-around">
<a href="/" role="button" class="btn btn-info mx-auto btn-sm">these words</a>
<a href="/" role="button" class="btn btn-info mx-auto btn-sm">are</a>
<a href="/" role="button" class="btn btn-info mx-auto btn-sm">different lengths unfortunately</a>
</div>
<div class="d-flex justify-content-around">
<a href="/" role="button" class="btn btn-info mx-auto btn-sm">aa</a>
<a href="/" role="button" class="btn btn-info mx-auto btn-sm">bbb</a>
<a href="/" role="button" class="btn btn-info mx-auto btn-sm">cccccccc</a>
</div>
Is there a recommended fix for this alignment issue, especially in terms of utilizing Bootstrap 4.5?