2

How can I change the color of my slider from

<input type="range" id="input">

I already tried color, bg-color and background-color and it won't change...

UPDATE:

I wanna change it with javascript. Something like this:

document.getElementById("input").style.background-color = "000000";
Lithilion
  • 1,097
  • 2
  • 11
  • 26
  • Similar http://stackoverflow.com/questions/3556157/how-to-customize-the-html5-input-range-type-looks-using-css – PiLHA Aug 28 '13 at 16:39

1 Answers1

9

Try this:

input[type=range] {
    -webkit-appearance: none;
    background-color: silver;
    width: 200px;
    height:20px;
}

input[type="range"]::-webkit-slider-thumb {
     -webkit-appearance: none;
    background-color: #666;
    opacity: 0.5;
    width: 10px;
    height: 26px;
}

document.getElementById("input").style.backgroundColor = '#000000';

jsfiddle

Kiran
  • 20,167
  • 11
  • 67
  • 99