您还可以选择CSS−input[type="date"]::before{ "/> 您还可以选择CSS−input[type="date"]::before{ ">

首页  >  文章  >  web前端  >  在HTML5中,对于input type="date"字段不显示占位符。如何解决这个问题?

在HTML5中,对于input type="date"字段不显示占位符。如何解决这个问题?

PHPz
PHPz转载
2023-09-06 20:45:041108浏览

在HTML5中,对于input type="date"字段不显示占位符。如何解决这个问题?

要显示它,使用以下内容 −

<input placeholder = "Date" class = "textbox-n" type = "text" onfocus = "(this.type = &#39;date&#39;)"  id = "date">

您还可以选择CSS −

input[type="date"]::before{
   color: #ffffff;
   content: attr(placeholder) ": ";
}
input[type="date"]:focus::before {
   content: "" !important;
}

以上是在HTML5中,对于input type="date"字段不显示占位符。如何解决这个问题?的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文转载于:tutorialspoint.com。如有侵权,请联系admin@php.cn删除