input 光标颜色 和 placeholder 属性样式(颜色,大小,位置)

1、input 光标颜色

input 光标颜色和定义的字体颜色一样绑定 color 即可

input {
  color: red;
}

2、placeholder 样式修改

input::-webkit-input-placeholder {
  /* placeholder颜色  */
  color: #666;
  /* placeholder字体大小  */
  font-size: 12px;
  /* placeholder位置  */
  text-align: right;
}

为兼容各个浏览器,如下:

input::-webkit-input-placeholder {
  /* WebKit, Blink, Edge */
  color: #666;
}
input:-moz-placeholder {
  /* Mozilla Firefox 4 to 18 */
  color: #666;
}
input::-moz-placeholder {
  /* Mozilla Firefox 19+ */
  color: #666;
}
input:-ms-input-placeholder {
  /* Internet Explorer 10-11 */
  color: #666;
}

猜你喜欢

转载自blog.csdn.net/yun_hou/article/details/86172804