Modify the css style of the text in the palceholder
::-webkit-input-placeholder{
color: red;
font-size: 20px;
line-height: 50px;
}
Modify the css style of the text in the palceholder with the class name
test1.test1::- webkit-input-placeholder{
color: red;
font-size: 20px;
line-height: 50px;
}
example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> input{ height: 50px; font-size: 14px; line-height: 50px; } .test1::-webkit-input-placeholder{ color: red; font-size: 20px; line-height: 50px; } </style> </head> <body> <input class="test1" type="text" placeholder="测试" /> <input type="text" placeholder="测试" /> </body> </html>
For compatibility, add the corresponding browser prefix
。