Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make two buttons the same size?

Tags:

html

css

How can I fix this because if the text is long the button will be longer.

enter image description here

button {
	border: none;
	padding: 1.1em 6.5em;
	background: #00abc6;
	color: #fff;
	font-family: 'TitilliumText22LRegular', Arial, sans-serif;
	font-weight:bold;
	font-size: 1.1em;
	border-radius: 0px;
}

button:hover {
	background: #3E3E3E;
}
<button class="md-trigger" data-modal="modal-1">Login</button>
		  <center><p>Or</p></center>
         <button class="md-trigger" data-modal="modal-2">Register</button>
like image 556
Mat Avatar asked Jul 01 '15 11:07

Mat


People also ask

How do you make 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 reduce the space between my buttons?

Browsers always add spaces between some elements, including buttons. To remove these, you need to set font-size to zero for their parent container. Then, to restore text size inside buttons, set font-size for them.


2 Answers

In this case you should use. min-width attribute. Use min-width:100px

like image 106
Mathivanan Avatar answered Sep 24 '22 02:09

Mathivanan


you need to set a width and height for your button and to centre text horizontally and vertically use the following:

 width:120px;
 height:50px;
 text-align:center;
 line-height:1.1em;
 font-size:1.1em;

width and height can be set to match your desired measurements.

This can be used for future demonstration:

https://jsfiddle.net/j9njkwkq/

EDIT: of course you can add cursor:pointer in order to get the "right" button effect on a browser.

like image 38
Pierre Irani Avatar answered Sep 24 '22 02:09

Pierre Irani