To all my CSS/HTML Masters, suppose I have 3 columns in a row, and each column is a different size (see image).
Imagine I want to center the 2nd column in the center of my page.
If I were to just center the content of this row using justify-content: center
, it would center the total row as it is below.
But what if I wanted to center only the 2nd column in the center of my page, kinda like centering the row based on only one of the columns, but still keeping all columns in a row.
Is this possible? Thanks.
PS: No obvious answers like "add margin-left to the row", the solution needs to be dynamic and responsive.
<!-- Code using bootstrap v15 classes -->
<div class="row w-100">
<div class="col-2 purple-bg">
<span>1st column</span>
</div>
<div class="col-4 green-bg">
<span>2nd column</span>
<b class="d-block">I want this column to be centered in the page</b>
</div>
<div class="col-6 red-bg">
<span>3rd column</span>
</div>
</div>