iOS 5.0 Safari not vertically centering placeholder in text box

前端 未结 5 1613
轻奢々
轻奢々 2021-02-01 03:23

I want to vertically center the text entered in input text boxes on the page.

Typical way to achieve this is to set the line-height and height equal. This works on pre

5条回答
  •  执念已碎
    2021-02-01 04:24

    For me there is only one solution that appears close to perfect in all browsers I tested (Chrome, FF, Safari (+iOS), IE10):

    line-height: normal;

    Solutions like line-height: 100% and line-height: 1; seem to be aligned towards the top of the input, especially in Chrome.

    http://jsfiddle.net/5Vc3z/

    Comparison:

    http://jsfiddle.net/5Vc3z/1/

提交回复
热议问题