To recreate the issue I am facing, I created a basic HTML structure with 2 bootstrap columns. My aim is to have multiple <p>
elements in the second column, stacked one below the other. However, the problem arises when these <p>
tags contain text of varying lengths. I want them to appear centered within the column while also starting at the same position along the X-axis.
<body>
<h2 class="text-center my-5">
title
</h2>
<div class="container">
<div class="row">
<div class="col-md-6 ">
Some unrelated text
</div>
<div class="col-md-6">
<p>Small text</p>
<p>A much longer text</p>
</div>
</div>
</div>
I specifically want the "A much longer text" string to be positioned directly below "Small text," creating this desired layout:
Small text
A much longer text
Instead of:
Small text
A much longer text
I attempted using text-align:center and flexbox with align-items:center on the column but encountered the same outcome in both cases.