有一个输入类型范围。他需要为轨道制作一个渐变背景(我这样做了)和一个带有渐变框的圆圈,但问题是,我没有找到一种方法来制作带有渐变框的圆圈形式的滑块。是否可以在没有js的情况下执行此操作,或者至少不用js模拟滑块的工作?
input[type=range] {
height: 24px;
-webkit-appearance: none;
margin: 10px 0;
width: 1052px;
margin-top: 167px;
position: relative;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 24px;
cursor: pointer;
background: linear-gradient(90deg, rgba(16,27,105,1) 0%, rgba(169,0,67,1) 100%);
border-radius: 20px;
border: 0px solid #ffffff;
z-index: 1;
}
input[type=range]::-webkit-slider-thumb {
border: 10px solid rgba(166,103,255,1);
height: 133px;
width: 133px;
border-radius: 50%;
background: #fff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -50px;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 24px;
cursor: pointer;
background: linear-gradient(90deg, rgba(16,27,105,1) 0%, rgba(169,0,67,1) 100%);
border-radius: 20px;
border: 0px solid #ffffff;
z-index: 1;
}
input[type=range]::-moz-range-thumb {
border: 10px solid rgba(166,103,255,1);
height: 133px;
width: 133px;
border-radius: 50%;
background: #fff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -50px;
}
input[type=range]::-ms-track {
width: 100%;
height: 24px;
cursor: pointer;
background: transparent;
border-color: transparent;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: linear-gradient(90deg, rgba(16,27,105,1) 0%, rgba(169,0,67,1) 100%);
border-radius: 20px;
}
input[type=range]::-ms-fill-upper {
background: linear-gradient(90deg, rgba(16,27,105,1) 0%, rgba(169,0,67,1) 100%);
border-radius: 20px;
}
input[type=range]::-ms-thumb {
border: 10px solid rgba(166,103,255,1);
height: 133px;
width: 133px;
border-radius: 50%;
background: #fff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -50px;
}
<input class="gradient" type="range" min="500" max="800000" value="250000" name="range" step="1">