Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the color of the small clock icon that comes with the html input tag with type=time

Tags:

html

css

input

I am trying to change the color of the small clock icon that appears within the input box when the input type is set to time.

The HTML tag that I am talking about can be seen below:

<input class="timeBox" type="time" value="13:30"/>
like image 463
Ronan Byrne Avatar asked Jul 20 '20 19:07

Ronan Byrne


People also ask

How to get time in 24-hour format in html?

input type="time" The value of the time input type is commonly in 24-hour format ("hh:mm"). If the time includes seconds the format is always "hh:mm:ss".

How do I add AM PM to input type time?

If you want the time with AM & PM, check the first two values, and utilize something like the following: if(FirstTwoNums > 12){ FirstTwoNums -= 12; PM = true;}/*else, PM is false */ .

How do I hide the input time icon?

input[type="time"]::-webkit-calendar-picker-indicator { background: none; display:none; } removes the space too.


Video Answer


3 Answers

You can change it with filter. For more info on changing colors using filter, see this answer.

input[type="time"]::-webkit-calendar-picker-indicator{
  filter: invert(48%) sepia(13%) saturate(3207%) hue-rotate(130deg) brightness(95%) contrast(80%);
}
<input type="time">
like image 116
Jespertheend Avatar answered Nov 15 '22 23:11

Jespertheend


You can customize icon image, using colored image.

.a {
position: relative;
height: 68px;
}
.a::-webkit-calendar-picker-indicator {
    width: 64px;
    height: 64px;
    background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAEr0lEQVR4nO2af2hVZRjHP88550I/zNrCiLaUpBYkJYYWNmtFUU3UchPJzGGJs1oRhRDDJkWaYLAERdugZG70hwyj1BY0Y6VWWCEUEqbVH1v900hI/8ndc57+uLvRLtvded9zzr2i5wOXcc7e9/k+93mf57nnPedASkpKSsqli5TbgZkv6fTsCFsR6oDrLc2cVej3Alp/2yUnTSaWNQA3Pae3InwNVMRiUPjLdZh9ersMhZ3ixSJsiSdsUaUC6HOUtb6DI0o3UCfQdWqXrA5j5+YXtZosnSj1BLQDy8P64Ni5Hg+uz4NeAIzQ/PO78vsvO2XQ8XnWC8ANeDSs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04AmD2cDTgnBeAE5T/Nfv9NVo1+m6w0bPAQowC4CrfugoiNEURjYPLHZrc3NPg76LYMWuCPu0qPAC8cahG8YU9D58sbRM8VKNVAk0Eo9cBSnsUe8ap/MUtugnYEEU0RjbVnZK2KAasavmrmbpIhZeBu4ApURyw4BxwDKW99lc5WGLtlJSUlJSLin8BxSm4QhC/BVoAAAAASUVORK5CYII=");
}
<input class="a" type="time" />
like image 26
Dmitry Kolchev Avatar answered Nov 15 '22 23:11

Dmitry Kolchev


I think the best you can do is change the background color or you can remove it entirely

input[type="time"]::-webkit-calendar-picker-indicator{
background-color:blue;
}
<input class="timeBox" type="time" value="13:30"/>
like image 30
DCR Avatar answered Nov 15 '22 23:11

DCR