Align Button to Right Side in Bootstrap 5, 4, 3, and CSS

Last Updated on December 31, 2024 by Roshan Parihar

Learn how to align button to right side in Bootstrap. The short answer is: in Bootstrap 5, use the class .text-end to align button to right side. You can also use the CSS text-align property for alignment of buttons to the right side.

How to Align Button to Right in Bootstrap 5, 4, and 3

There can be different classes in different versions of Bootstrap. Let’s find out with the examples given below.

Align Button to Right in Bootstrap 5

To align button to right side in Bootstrap 5, you have to first place the button inside the <div> element. After that, use the class .text-end as given below.

Test it Live

Output

right align button in bootstrap5

Right Button Alignment in Bootstrap 4

For button alignment to right side in Bootstrap 4, you have to place the button inside the div and use the class .text-right as given below.

Test it Live

Output

right align button in bootstrap 4

Alignment in Bootstrap 3

For right alignment of button in Bootstrap, you have to place it inside the <div> element and use the class .text-right. It is the pre-made class of Bootstrap to position the content (e.g. text, button, etc.) to the right side. See the example below showing the added class to position.

Test it Live

Output

right align button in bootstrap 3

The above example uses the Bootstrap button classes to create a button. After that, it applies the .text-right class for button alignment to the right side.

Bonus: download a Free Bootstrap CHEAT SHEET that will show you 20+ most important examples to learn in Bootstrap.

Position Using CSS

In addition to the above method, you can also use the CSS text-align property for button alignment. To position button to the required side, you have to first insert a button inside the <div> element and pass the value right for this property. See the below example to learn the method.

Output

The above example showing the right aligned button using CSS. Similarly, you place more buttons inside the <div> element to move them to the required position.

DOWNLOAD Free Bootstrap CHEAT SHEET