Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

left right alignment for key-pair value in bootstrap

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:

enter image description here

However ideally I want it to look like the following (ignore the font change. I only care about the alignment):

enter image description here

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?

like image 970
MHOOS Avatar asked Apr 24 '17 20:04

MHOOS


People also ask

How Left and Right align text within a div 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.

How do I align an item to the right in Bootstrap?

Using .align-self-end is used to align a single item in a Flexbox to the right.

How do I align a label to the right in Bootstrap?

Use the . form-horizontal class in Bootstrap to align labels and groups of form controls in a horizontal layout.

How do I align left and right in CSS?

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'.


1 Answers

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

like image 139
Hemant Avatar answered Oct 02 '22 16:10

Hemant