HTML5 placeholder css padding

后端 未结 14 1749
失恋的感觉
失恋的感觉 2020-12-04 06:49

I\'ve seen this post already and tried everything I could to change the padding for my placeholder but alas, it seems it just doesn\'t want to cooperate.

Anyway, her

相关标签:
14条回答
  • 2020-12-04 07:16

    I got the same issue.

    I fixed it by removing line-height from my input. Check if there is some lineheight which is causing the problem

    0 讨论(0)
  • 2020-12-04 07:16

    If you want move placeholder text right and leave the cursor on the blank space you need to add space(s) at the start of the placeholder attribute:

    <input type="email" placeholder="  Your email" />
    
    0 讨论(0)
  • 2020-12-04 07:17

    Setting line-height: 0px; fixed it for me in Chrome

    0 讨论(0)
  • 2020-12-04 07:20

    I had a problem, which appears just in internet explorer. Input field was styled

    height:38px;
    line-height:38px;
    

    Unfortunately in IE the initial placeholder appears not at the correct position. But when I have clicked into the field and then left this field, the placeholder appeared on the right position.

    My solution was to set:

    line-height:normal;
    
    0 讨论(0)
  • 2020-12-04 07:25

    Remove line-height or set using padding...it's working in all browser

    0 讨论(0)
  • 2020-12-04 07:26

    I've created a fiddle using your screenshot as a background image and stripping out the extra mark-up, and it seems to work fine

    http://jsfiddle.net/fLdQG/2/ (webkit browser required)

    Does this work for you? If not, can you update the fiddle with your exact mark-up and CSS?

    0 讨论(0)
提交回复
热议问题