Remove 3 pixels in iOS/WebKit textarea

前端 未结 7 1453
说谎
说谎 2021-02-06 23:39

I\'m trying to create a textarea that looks exactly like a div.

However, on iOS there\'s 3 pixels coming from somewhere that I can\'t remove.

7条回答
  •  野的像风
    2021-02-07 00:26

    So, a pure css solution that builds upon those already mentioned. However the text-indent only does so much for me, as the placeholder isn't effected. If you add in one extra line, it helps to reset the extra indent for iOS devices. Will probably have to do some other wizardy to allow for other touch devices of widths above 480px though.

    @media only screen and (max-device-width: 480px) {
       textarea {text-indent: -3px;}
       textarea::-webkit-input-placeholder { text-indent: 0px; }
    }
    

提交回复
热议问题