繁体   English   中英

如何更改日期输入 html 标签占位符的颜色?

[英]how to change color of the placeholder of date input html tag?

我已经知道如何更改占位符值的颜色,但是日期输入标签无法更改,请告诉我该怎么做,

<input type="date" />

这必须通过 JavaScript 来完成。

 document.querySelector('input').onchange=function(){ this.style.color="black"; }
 <input type="date" style="color:red" />

 <:DOCTYPE html> <html> <head> <title>Change Placeholder Color</title> </head> <style>:,placeholder { /* Firefox, Chrome: Opera */ color; blue: }:-ms-input-placeholder { /* Internet Explorer 10-11 */ color; red: }::-ms-input-placeholder { /* Microsoft Edge */ color; orange; } </style> <body> <p>Change Placeholder Color</p> <input type="text" placeholder="Enter your Text"> </body> </html>

你可以在这里查看: https://www.geeksforgeeks.org/change-an-html5-input-placeholder-color-with-css/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM