Are there any style options for the HTML5 Date picker?


The date picker in HTML5 shows a popup like a calendar. This is the same as selecting the months and years and this adds the date.

Example: Style options for HTML date picker

You can also customize the popup and add background color as well. You can try to run the following code to add style options for HTML date picker −

::-webkit-datetime-edit { padding: 4 em; }
::-webkit-datetime-edit-fields-wrapper { background:blue; }
::-webkit-datetime-edit-text { padding: 0 0.5em; }

Editing a month, day and year field

The following is to edit a month, day and year field −

::-webkit-datetime-edit-month-field { color: white; }
::-webkit-datetime-edit-day-field { color: red; }
::-webkit-datetime-edit-year-field { color: red; }
::-webkit-calendar-picker-indicator { background:gray; }

Updated on: 22-Nov-2023

960 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements