input的placeholder不垂直居中,input设置高度后,使用line-height只能使输入的文字垂直居中,但是placeholder不会居中,反而会偏上。 首先placeholder样式自定义 有两种方法,第一种行内样式:
input的placeholder不垂直居中,input设置高度后,使用line-height只能使输入的文字垂直居中,但是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,把提示文字顶下来
参考:iOS下input的placeholder不垂直居中的问题
来源地址:https://blog.csdn.net/qq_43437571/article/details/132511830
--结束END--
本文标题: 小程序input的placeholder不垂直居中的问题解决
本文链接: https://www.lsjlt.com/news/383112.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0