使用CSS设置placeholder的样式

时间:2025-03-20 11:45:38
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <style> #username::placeholder { color: red; } </style> </head> <body> 用户名:<input id="username" type="text" placeholder="请输入用户名" /> </body> </html>

相关文章