Lets say I have the following:
<div class="card">
<ul class="list-group list-group-flush ">
<li class="list-group-item" style="border: none;">
<strong>Something</strong> : 12333434
</li>
<li class="list-group-item" style="border: none">
<strong>Something else</strong>: 2837487248723847283
</li>
<li class="list-group-item" style="border: none">
<strong>Some other stuff</strong>: 123442342423423
</li>
</ul>
</div>
Above looks like the following in browser:
However ideally I want it to look like the following (ignore the font change. I only care about the alignment):
Meaning the left side gets aligned to the right while the right side text gets aligned to the left. How can I achieve this in bootstrap?
You can simply use the class . justify-content-between in combination with the class . d-flex to left align and right align text content within a <div> container in Bootstrap 4.
Using .align-self-end is used to align a single item in a Flexbox to the right.
Use the . form-horizontal class in Bootstrap to align labels and groups of form controls in a horizontal layout.
For aligning columns to the left, the align-content property will set to 'flex-start'. For aligning columns to the right, the align-content property will set to 'flex-end'. For aligning columns to the extreme ends, the align-content property will set to 'space-between'.
Using inline-block
this can be achieved.By default strong
is inline
.
strong{
display:inline-block;
width:200px;
text-align:right;
}
Here is the fiddle link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With