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>
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.
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>
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>
pull-right
is working fine
DEMO
<button class="btn-info btn pull-right">Log in</button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With