方法:

代码示例:

 1 .input::-webkit-input-placeholder {
 2   font-size: 3.73333333vw;
 3   color: #cccccc;
 4 }
 5 .input:-moz-placeholder {
 6   font-size: 3.73333333vw;
 7   color: #cccccc;
 8 }
 9 .input:-ms-input-placeholder {
10   font-size: 3.73333333vw;
11   color: #cccccc;
12 }

注意:设置placeholder的字体大小时须给input也设置相同字体大小,不然在移动端会有bug出现。

对比效果图如下:

正常:

设置input中placeholder的样式(placeholder设置字体)

异常:

设置input中placeholder的样式(placeholder设置字体)

 

相关文章:

  • 2022-12-23
  • 2021-08-31
  • 2021-04-17
  • 2022-01-20
  • 2022-03-02
  • 2022-01-21
猜你喜欢
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-18
相关资源
相似解决方案