Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML button text alignment in Firefox

Tags:

html

css

firefox

Using this CSS:

button {
    font-size: 14px;
    height: 25px;
    width: 25px;
    text-align: center;
    vertical-align: middle;
    padding: 0;
    margin-left: auto;
    margin-right: auto;
}

I am unable to align certain text properly in Firefox. For example:

Firefox (38.0.5)

enter image description here

Chrome

enter image description here

The horizontal alignment of the [+] button is off in Firefox, but not in Chrome? What's going on and how can I fix it?

JSFiddle: http://jsfiddle.net/oge3tg3n/2/

like image 611
martinez314 Avatar asked Feb 15 '26 06:02

martinez314


1 Answers

If you increase the height and width to 27px, the alignment will be centered in both firefox and chrome.

button {
   font-size: 14px;
   height: 27px;
   width: 27px;
   text-align: center;
   vertical-align: middle;
   padding: 0;
   margin-left: auto;
   margin-right: auto;
}

Tested in firefox 38.0.5.

like image 52
Byron Avatar answered Feb 17 '26 22:02

Byron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!