You can also choose CSS −input[type="date"]::before{ "/> You can also choose CSS −input[type="date"]::before{ ">

Home  >  Article  >  Web Front-end  >  In HTML5, placeholders are not displayed for input type="date" fields. how to solve this problem?

In HTML5, placeholders are not displayed for input type="date" fields. how to solve this problem?

PHPz
PHPzforward
2023-09-06 20:45:041107browse

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

To display it, use the following −

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

You can also choose CSS −

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

The above is the detailed content of In HTML5, placeholders are not displayed for input type="date" fields. how to solve this problem?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete