1

I've a Button with the following super simple css:

button {
  background: #005eb8;
  border: 0;
  padding: 0;
  color: white;
  line-height: 50px;
}

"line-hight" is set to 50px. But the button is (in Firefox) 52px - I expected it to be 50. Is there any reason for that? In chrome the height is 50 as expected...

Code at JSBIN: http://jsbin.com/jagiviyima/9?html,output

Matthias
  • 10,816
  • 2
  • 19
  • 12

2 Answers2

1
button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner {
   border: none;
   padding:0;
}

Add such css rule.

Mr Posia
  • 81
  • 4
  • Wow! That works. I've spend now hours on this - but I never though about focus-inner ...?! :-=) Thanks. – Matthias Jan 26 '15 at 17:09
1

You ask - is there some reason for that - I believe it is. I don't have Firefox at hand now, but you are using button html element and buttons typically have some default css rules applied to them across the browsers (these are obviously browser specific). My guess is FF is adding some default padding, margin, border or something of that kind to your own defined style. Try setting these to 0 explicitly.

A bit of googling yielded this SO answer which exlains the issue in a more detail, proposed resolution is:

button::-moz-focus-inner, 
input[type="button"]::-moz-focus-inner {
    padding: 0 !important;
    border: 0 none !important;
}
Community
  • 1
  • 1
Michal Hosala
  • 5,570
  • 1
  • 22
  • 49