HTML5 中,输入类型为"date"的字段不显示占位符。如何解决?
htmlweb developmentfront end technology更新于 2025/8/22 2:52:17
要显示占位符,请使用以下 −
<input placeholder = "Date" class = "textbox-n" type = "text" onfocus = "(this.type = 'date')" id = "date">
您也可以选择 CSS −
input[type="date"]::before{
color: #ffffff;
content: attr(placeholder) ": ";
}
input[type="date"]:focus::before {
content: "" !important;
}
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

