How can I fix this because if the text is long the button will be longer.
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>
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.
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.
In this case you should use. min-width attribute.
Use min-width:100px
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.
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