Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap column not right aligning

I am trying to have a row across my screen, with Login information on the left, and then some other info on the far right, right justified. This is my unsuccessful attempt:

<div class="container well">     <div class="row">         <div class="col-lg-6">             @(Session["CurrentUserDisplay"] != null ? "Welcome, " + @Session["CurrentUserDisplay"] : "Not logged in")         </div>         <div class="col-lg-6 pull-right">Active Portfolio: @(Session["ActivePortfolioName"].ToString())          </div>     </div> </div> 

But the 2nd column is sitting in the middle of the row, so seems it's not right justified in the 'cell'. Can anyone guide me to get this right?

like image 630
Craig Avatar asked Dec 31 '13 09:12

Craig


People also ask

How do I move a column right in Bootstrap?

To move columns to the right, use the . col-*-offset-* class in Bootstrap.

How do I align columns in Bootstrap?

To horizontally align columns, we can use the justify-content classes. justify-content-start left align the columns. justify-content-center center aligns the columns. justify-content-end right align the columns.

How do I put text on the right side 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.


2 Answers

Instead of pull-right use text-right.

text-right class aligns the content of that element to right by using text-align: right.

pull-right class aligns the element itself by using float:right.

like image 153
ravisuhag Avatar answered Oct 01 '22 09:10

ravisuhag


I think you need to use offset. Add the class col-md-offset-*

You can read more in doc: http://getbootstrap.com/css/#grid-offsetting

like image 26
Christian Avatar answered Oct 01 '22 09:10

Christian