Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Change the icon which displays on the datalist input in HTML? Hiding is possible , but can i change it to some other icons, Like arrow-down?

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

This is the code for hiding it. How can I change the icon to some other icons?

like image 672
Shusil Banjade Avatar asked Sep 26 '22 03:09

Shusil Banjade


1 Answers

The trick is to hide the icon using opacity:0, then you can add your own icon. In this simple I'm using fontawesome calendar icon.

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" />
like image 124
Mosh Feu Avatar answered Sep 28 '22 05:09

Mosh Feu