What I want to know.
I would like to create and customize a slider in HTML.
While various sites explain how to customize the slider itself, I could not find any explanation of how to customize the scale itself.
If I add data using input="range"
, datalist
, or option
, how do I change the color of the ticks added by datalist?
<input
type="range"
min=0
max=100
step={1}
list="tickmarks"
/>
<datalist id="tickmarks">
{Array.from({ length: max - min + 1 }, (_, i) => i + min).map((label) => (
<option key={label} value={label}/>
))}
</dataList>
2
Answers
Try this:
use
accent-color
that will help to change the color of input type rangeTo create ticks programatically: