iOS 5.0 Safari not vertically centering placeholder in text box

前端 未结 5 1723
轻奢々
轻奢々 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 03:59

    Assuming you are just trying to make the input field appear larger then you could use padding:

    .txtBox {
        font-size: 1em;
        padding: 1em auto;
    }
    

    Also, your input field should be:

    
    

    Edit

    Sorry, took a little while. It appears that placeholder can be styled individually and / or inherit styles from the parent. Unfortunately there are quite a lot of styles that are not supported by Safari at this time.

    The following blog has details about the styling techniques and which are / are not supported within certain browsers:

    http://blog.ajcw.com/2011/02/styling-the-html5-placeholder/

提交回复
热议问题