Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How right align bootstrap form button?

Please tell me how right align this form "Log in" button using bootstrap. I tired to use pull-right class. But after resizing my button is not in the correct position.

<div role="form">     <div class="form-group">         <label>Username</label>         <input type="text" class="form-control"/>     </div>      <div class="form-group">         <label>Password</label>         <input type="password" class="form-control"/>     </div>      <div class="checkbox">         <label>             <input type="checkbox"> Remember Me         </label>     </div>      <button class="btn-info btn">Log in</button>                             </div> 
like image 982
Nadishan Avatar asked Aug 21 '14 07:08

Nadishan


People also ask

How do I center align a button in Bootstrap?

Answer: Use the text-center Class You can simply use the built-in class . text-center on the wrapper element to center align buttons or other inline elements in Bootstrap. It will work in both Bootstrap 3 and 4 versions.


2 Answers

You can use text-right first you have to wrap it in a div like this:

<div class="text-right">      <button class="btn-info btn">Log in</button> </div> 

LIVE-DEMO

Here is the full code

<div role="form">     <div class="form-group">         <label>Username</label>         <input type="text" class="form-control"/>     </div>      <div class="form-group">         <label>Password</label>         <input type="password" class="form-control"/>     </div>      <div class="checkbox">         <label>             <input type="checkbox"/> Remember Me         </label>     </div>      <div class="text-right"> <!--You can add col-lg-12 if you want -->         <button class="btn-info btn">Log in</button>     </div> </div> 

enter image description here

like image 168
Gildas.Tambo Avatar answered Sep 23 '22 06:09

Gildas.Tambo


pull-right is working fine

DEMO

<button class="btn-info btn pull-right">Log in</button> 
like image 36
Suganth G Avatar answered Sep 20 '22 06:09

Suganth G