Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3, how to right align button on the navbar?

I host coding and preview here.

I would like to right-align my 2nd button, please show me how to do that.

Thanks.

like image 711
Artisan Avatar asked Sep 18 '13 14:09

Artisan


People also ask

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

Answer: Use the text-right Class You can simply use the class . text-right on the containing element to right align your Bootstrap buttons within a block box or grid column. It will work in both Bootstrap 3 and 4 versions.

How do I align navbar items to the right in Bootstrap?

ml-auto class in Bootstrap can be used to align navbar items to the right. The . ml-auto class automatically aligns elements to the right.


2 Answers

Check demo

.navbar-header{   margin-left:5px;   width:100%; } 

And add

pull-right

class to your button.

like image 182
Anshad Vattapoyil Avatar answered Sep 25 '22 17:09

Anshad Vattapoyil


For Bootstrap 3, .navbar-right does just that.

<ul class="nav navbar-nav navbar-right"> . . </ul> 
like image 35
Ajoy Avatar answered Sep 21 '22 17:09

Ajoy