iOS 5.0 Safari not vertically centering placeholder in text box

前端 未结 5 1606
轻奢々
轻奢々 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:09

    I got stuck on this issue for a long time despite using

    input::-webkit-input-placeholder { line-height:normal!important; }

    It turns out the having a line-height in the input element by itself was breaking my input::webkit-input-placeholder line-height.

    Solution extended:

    I removed the line-height in my input style and it fixed my issue.

提交回复
热议问题