Click to See Complete Forum and Search --> : Centering text in input field vertically?


apeg
11-12-2009, 01:02 AM
I have a text field that for design reasons is 30px fixed height, I can center the users entered text horizontally, but don’t have a good way vertically.

I can push it down with padding but run into small inconsistencies cross browser. I know vertical centering isn’t simple thing, but I’m hoping because it’s an input field there is a very simple solution?

Thanks
-apeg

mitya
11-12-2009, 05:53 AM
Set its line-height to 30px. Works in most browsers.

apeg
11-12-2009, 08:50 AM
Speaking of very simple solutions, Thanks mitya

This is a first, its working in all browsers (incl IE6) but not firefox. A little browser specific CSS will fix that.