Home > Web Front-end > HTML Tutorial > 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
Release: 2023-09-06 20:45:04
forward
1189 people have browsed it

在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">
Copy after login

You can also choose CSS −

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

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template