【发布时间】:2016-04-23 08:44:36
【问题描述】:
我想自定义输入类型范围,例如this。
我尝试使用以下代码更改拇指,如下所示,但所选范围颜色没有更改。
HTML:
<input type="range" />
CSS:
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
height: 20px;
width: 20px;
border-radius: 10px;
background: red;
cursor: pointer;
border: none;
margin-top: -8px;
}
input[type=range] {
-webkit-appearance: none;
outline: 0;
margin: 0;
padding: 0;
height: 30px;
width: 100%;
}
有人可以建议我更改选定的可运行轨道背景颜色吗?
【问题讨论】:
-
纯 CSS 解决方案可以在这里找到:stackoverflow.com/a/38163892 特别是,它使用 box-shadow 来模拟 Chrome 中轨道上的颜色分割。
标签: css html pseudo-element input-type-range