Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to align two buttons horizontally

Tags:

html

css

How do I make two button aligned horizontally in a div? I want no space between the two buttons.

like image 877
Jensen Avatar asked Dec 01 '11 18:12

Jensen


People also ask

How do you align buttons horizontally?

We can align the buttons horizontally as well as vertically. We can center the button by using the following methods: text-align: center - By setting the value of text-align property of parent div tag to the center. margin: auto - By setting the value of margin property to auto.

How do I align two buttons on the same line?

If you have multiple buttons that should sit side-by-side on the same line, add the data-inline="true" attribute to each button. This will style the buttons to be the width of their content and float the buttons so they sit on the same line.

How do I align two buttons to the right in HTML?

You can remove floats and align the container of your "buttons" to the right with the property text-align . You don't want your heading to be aligned to the right so you've to cancel it with text-align: left; .

How do you center two buttons?

Sometimes you might want to have two buttons next to each other, but to center both together on the page. You can achieve this by wrapping both buttons in a parent <div> and using flexbox to center them on the page. Notice that we also added margin-right: 20px to the first button, in order to add space between them.


1 Answers

Well, they are by default aligned. Just check this code snippet and you'll understand better :) Just make sure to leave no white space between the buttons.

like image 58
Savas Vedova Avatar answered Sep 22 '22 11:09

Savas Vedova