views:

23

answers:

1

We need bigger text inputs for our forms, so easy enough, we just set the height on them... But Firefox 3.5 then keeps the text at the top. How do I vertically center it? On Firefox 3.6, IE8, Chrome and Safari, the text is vertically centered as I hoped.

<form>
  <input type="text" style="height: 50px"/>
</form>

How do I make the text in this form centered in its input box?

+1  A: 

Use padding instead...

input[type=text] {
   padding: 25px 0; /* experiment with padding */
}

or

Use the line-height hack... (only works with single line inputs, not textareas)

input[type=text] {
   line-height: 50px;
   height: 50px;
}
alex
Padding does in fact work, but the problem is I can't control the height precisely anymore pixel-wise. If the user increases the font size my text input graphics next to it goes all out of whack. line-height has no effect on single line text inputs (in firefox 3.5 at least) whatsoever.
at
@at I forgot to say you need to still include the height. See my update.
alex
line-height with or without height has no effect on firefox 3.5
at
I don't have Firefox 3.5, but [I can see it doesn't work](http://api.browsershots.org/png/original/77/771a4a24d53e45be4d90bc7baff2deb9.png). Why are you targeting 3.5 anyway? Most FireFox users are usually always on the latest stable version.
alex
Yes, I guess you're right alex... a decent portion of our visitors use FF and we have many input fields that look odd to them. But inevitably the number of those visitors will dwindle. Was just hoping there was an easy solution.
at
@at Unfortunately I don't know of one. Best you could do is play around with the padding.
alex