<分区>
如何更改 slider 的颜色
<input type="range" id="input">
我已经尝试过 color、bg-color 和 background-color 都不会改变...
更新:
我想用javascript改变它。像这样:
document.getElementById("input").style.background-color = "000000";
标签 javascript css html
<分区>
如何更改 slider 的颜色
<input type="range" id="input">
我已经尝试过 color、bg-color 和 background-color 都不会改变...
更新:
我想用javascript改变它。像这样:
document.getElementById("input").style.background-color = "000000";
最佳答案
试试这个:
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';
关于javascript - 使用javascript更改输入范围 slider 的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18493591/