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.
Let's try out the following example to understand how it basically works:
Let's check out one more example. Here, buttons and text are placed inside a div element side by side. To align text to the left and buttons to right we need to use the .float-right property on the button elements. Also, if the button elements are not inside a grid column (i.e., .col-*) then you also need apply the class .clearfix on the parent <div> element.
<div class="bg-light clearfix">
<span>Click any button to proceed</span>
<button type="button" class="btn btn-warning float-right">Save</button>
<button type="button" class="btn btn-primary float-right">Cancel</button>
</div>
If you're using the Bootstrap 3 version please replace the class float-right with pull-right class.
Use the
text-right
ClassYou 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.Let's try out the following example to understand how it basically works:
Let's check out one more example. Here, buttons and text are placed inside a div element side by side. To align text to the left and buttons to right we need to use the .float-right property on the button elements. Also, if the button elements are not inside a grid column (i.e., .col-*) then you also need apply the class .clearfix on the parent <div> element.
If you're using the Bootstrap 3 version please replace the class float-right with pull-right class.
need an explanation for this answer? contact us directly to get an explanation for this answer