input placeholder属性 样式修改(颜色,大小,位置)

时间:2023-03-08 23:45:57
input placeholder属性 样式修改(颜色,大小,位置)

placeholder属性 样式修改

 <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style> input::-webkit-input-placeholder {
/* placeholder颜色 */
color: #aab2bd;
/* placeholder字体大小 */
font-size: 12px;
/* placeholder位置 */
text-align: right;
}
input {
border: 1px solid red;
}
</style>
</head>
<body> <input type="text" placeholder="请输入手机号"> </body>
</html>

显示结果:

input placeholder属性 样式修改(颜色,大小,位置)

备注:

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