input的placeholder不垂直居中,input設置高度后,使用line-height只能使輸入的文字垂直居中,但是placeholder不會居中,反而會偏上。
- 首先placeholder樣式自定義
有兩種方法,第一種行內樣式:
<input type="text" placeholder="姓名" placeholder-style="font-size:28rpx;color:#999999;" />
第二種加類名:
給input加上placeholder-class屬性,然后給該屬性 設置一個類名,在style中設置樣式。
<input type="text" placeholder="地址" placeholder-class="address"/>
<style>
.address{
color: red;
}
</style>
placeholder的字體顏色都能改變,但是仍然不會在input框里垂直居中,一直偏上,查了很多方法都不管用,比如:
“
比如:
能垂直居中是能,但是input框變得沒有內邊距了,很不好看。
- 最后找到解決辦法了:
在placeholder上增加pandding-top,把提示文字頂下來文章來源:http://www.zghlxwxcb.cn/news/detail-675147.html
參考:IOS下input的placeholder不垂直居中的問題
文章來源地址http://www.zghlxwxcb.cn/news/detail-675147.html
到了這里,關于小程序input的placeholder不垂直居中的問題解決的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!