I have realized the problem before but I guess it didn't matter as much then as it did now.
What I discovered is that Firefox has a default line-height value of 1.2 for input fields which can not be changed. At least in OSX, don't have Windows so I can't confirm it there.
I did some experimenting and testing and there's just no way to change the default line-height value of Firefox. All the other browsers (ok, I just tried with Chrome and Safari) obey my value perfectly fine but not Firefox.
Has anyone ever noticed this and if yes, have you found a solution to overcome this?
Use
Height
instead ofLine-Height
. This works for me in almost all browser on Windows7, but I have not tested it on OSX.Line-height
cannot be applied to replaced inline elements such as buttons and inputs. This is the correct behavior relative to the Spec.See https://developer.mozilla.org/en/docs/Web/CSS/line-height for more details.
If your input and submit button are side by side, with the button down about 1px lower then the input (looks like your background image is off), a simple:
on the button lines it up perfectly in FF & IE.
I always style my buttons against anchors, buttons, labels, and submits to ensure that regardless of which element used, the outcome looks exactly the same.
Since Firefox insists on using
!important
to declareline-height
, the only way I can calmly overcome this issue is to force all other vendors to useline-height: normal
for buttons, and then use padding to vertically center the text:This works similarly for inputs.
Unfortunatelly the line-height is set to !important in the Firefox base css ... http://hg.mozilla.org/mozilla-central/rev/b97aef275b5e
Just give the wrapping form element the desired line height and at least all input fields of type="text" in Firefox will take that same line height. Submit buttons seem to behave differently though...