How to change the icon that appears on the datalist input in HTML? Hiding is possible, but can I change it to some other icons, like a down arrow?

input::-webkit-calendar-picker-indicator {
  display: none;
}
<input type="date" />
Run codeHide result

This is the code to hide it. How to change icon to other icons?

+4
source share
1 answer

The trick is to hide the icon with opacity:0, then you can add your own icon. In this simple one, I use the quotation mark icon fontawesome.

input::-webkit-calendar-picker-indicator {
  opacity:0;
}

input {
  position:relative;  
}

input:before {
  content: "\f073";
  display: inline-block;
  font: normal normal normal 14px/1 FontAwesome;
  font-size: inherit;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position:absolute;
  right:0;
  top:50%;
  transform:translateY(-50%);
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" />
<input type="date" />
Run codeHide result
+1
source

All Articles