开发者

Top align text in html input field?

Can I control the vertical alignment of text in an html input field? At the moment (presumably with the browser defaults) my text开发者_运维技巧 is too low.

Thanks


I'm not entirely sure that this is what you want, but to get the text to be vertically centered in an input field, you can set the line-height CSS property on the input field to the same as the height of that field.

.inputClass { height:50px; line-height:50px }


If there is no other CSS impacting the text display inside an input field, I always use padding, since it puts the text vertically in the center and also adds some space to the left and right of the field.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜