Does anyone know how to hide the calendar icon on a date field in Chrome?
<input type="date" />
When I look it up I find that I should use ::-webkit-calendar-picker-indicator
but that doesn't seem to do the trick.
Does anyone know how to hide the calendar icon on a date field in Chrome?
<input type="date" />
When I look it up I find that I should use ::-webkit-calendar-picker-indicator
but that doesn't seem to do the trick.
Try something like this
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-calendar-picker-indicator {
display: none;
-webkit-appearance: none;
}
<input type="date" class="date-input">
opacity: 0
. That way, the icon will be hidden in chrome based browsers while still retaining the functionality to show the date picker when users click on the location where the icon is ought to be. –
Kwangju showPicker()
developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/… –
Daman input[type="date"]::-webkit-inner-spin-button
, 4) You only need the display: none
, not anything affecting appearance
. –
Forbade Use below CSS to hide the calender sign from the calender icon from input.
input[type='date']::-webkit-calendar-picker-indicator {
background: transparent;
bottom: 0;
color: transparent;
cursor: pointer;
height: auto;
left: 0;
position: absolute;
right: 0;
top: 0;
width: auto;
}
input[type='date']::-webkit-calendar-picker-indicator {background:
transparent;
bottom: 0;
color: transparent;
cursor: pointer;
height: auto;
left: 0;
position: absolute;
right: 0;
top: 0;
width: auto;
}
While trying to figure this out easiest solution that I could find of is
input[type="date"]::-webkit-calendar-picker-indicator {
content: url('./assets/calendarv1.svg');
}
input[type="time"]::-webkit-calendar-picker-indicator {
content: url('./assets/clock-icon.svg');
}
but the problem with this is If your icon is like png I am if it has cutout. the default icon would also be visible like this image with 2 icons
here the solution is you can fill your icon's background with the same color as your input box background color
Method to hide the native datepicker icon which works in Chrome and Firefox.
Chrome
The native ::-webkit-calendar-picker-indicator is used
Non webkit Browser like Firefox
I simply added an after element on the wrapper as an overlay to hide the native icon. This overlay is not used on chrome.
.date-input-wrapper {
width: fit-content;
}
input {
width: 100%;
}
input[type=date]::-webkit-calendar-picker-indicator {
visibility: hidden;
}
.date-input-wrapper {
position: relative;
}
.date-input-wrapper::after {
display: none;
width: 17px;
height: 16px;
background: red;
/* background: white; */
position: absolute;
content: "";
right: 0px;
top: 2px;
}
@supports not selector(::-webkit-calendar-picker-indicator) {
.date-input-wrapper::before {
display: block;
}
}
<div class="date-input-wrapper">
<input type="date">
</div>
© 2022 - 2025 — McMap. All rights reserved.
::-webkit-calendar-picker-indicator
there are some comments on this SO question that might prove useful _ >>> #15531350 – Falsehood