Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I right align an element using twitter bootstrap?

I have 3 elements and I am trying to align the button to the right side of the screen, but am having trouble doing so.

<div class="container">   <div class="row-fluid">     <h4>       <img src="img.png" style="width:50px;">       Title       <a href="link_to_img.html" class="btn btn-success">Grab it!</a>     </h4>   </div> </div> 
like image 255
sharataka Avatar asked Mar 14 '13 23:03

sharataka


People also ask

How do I center align an element in Bootstrap?

One way to vertically center is to use my-auto . This will center the element within it's flexbox container (The Bootstrap 4 . row is display:flex ). For example, h-100 makes the row full height, and my-auto will vertically center the col-sm-12 column.

How do you put a div on the right?

Use CSS property to set the height and width of div and use display property to place div in side-by-side format. float:left; This property is used for those elements(div) that will float on left side. float:right; This property is used for those elements(div) that will float on right side.


2 Answers

Try the class 'pull-right'.

<div class="pull-right">...</div> 

See http://getbootstrap.com/css/#helper-classes-floats

like image 89
Stefan Avatar answered Oct 10 '22 19:10

Stefan


try something like this

<a href = "link_to_img.html" class = 'btn btn-success pull-right'>Grab it!</a> 
like image 43
trajce Avatar answered Oct 10 '22 17:10

trajce