15

I have three columns displayed in one row, I need to align last two to the right corner, it works fine with one column but when I try to pull-right two it messes up grid and pushes elements to the next row down. The question is how to align one column to the right and other next to it.

       <div class="row ">
                    <div class="col-sm-4">
                    ...
                    </div>

                    <div class="col-sm-3" >
                     ...
                    </div>

                    <div class="col-sm-5 pull-right">
                        <div class=" pull-right">
                          ...
                        </div>
                    </div>
        </div>

Current:

|[     ]       [      ]       [     ]|

Wanted:

|[     ]              [      ][     ]|
user2998105
  • 153
  • 1
  • 1
  • 4

2 Answers2

22

It depends on whether you're right aligning text inside the middle column, or some another container inside the column.. Here are a few examples that may work for you..

http://www.bootply.com/119747

<div class="row ">
  <div class="col-sm-4">
    1 text here 
  </div>
  <div class="col-sm-3 text-right">
    2 text here 
  </div>
  <div class="col-sm-5">
    3 text here 
  </div>
</div>

<div class="row ">
  <div class="col-sm-4">
    <div class="well"> 
      content
    </div>
  </div>
  <div class="col-sm-3">
    <div class="well pull-right"> 
      content pull-right 
    </div>
  </div>
  <div class="col-sm-5">
    <div class="well"> 
      content
    </div>
  </div>
</div>
Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
4

Use lower col size with offset like this:

<div class="col-sm-3"></div>
<div class="col-sm-3 offset-col-sm-3"></div>
<div class="col-sm-3"></div>
IKavanagh
  • 6,089
  • 11
  • 42
  • 47
molikh
  • 1,274
  • 13
  • 24