I have the following input element (I intentionally missed attributes that were not necessary for the example):
<input type="text" style="display: block; height: 40px; font-size: 14px; line-height: 40px"/>
In Chrome and Internet Explorer (perhaps Opera too), any text inside the input will be vertically centered. However, Firefox seems to ignore this expression. Instead, instead of display: inline-block; or using vertical-align: middle; not valid in Firefox.
I also tried setting the upper and lower paddings to 13px , and the height to 14px , which (combined with the font size) would result in a 40px tall element. This works as expected; except for characters with tails (e.g. g, q, j, etc.), bottom to bottom.
I am looking for a cross-browser solution for vertically aligning text in a fixed-height input field. The input element will have its own guidance and focusing style, so giving centering meaning by positioning the element vertically in the 40px top space is not really an option.
Greetings
source share