.range-field {
position: relative;
}
input[type=range],
input[type=range]+.thumb {
cursor: pointer;
}
input[type=range] {
position: relative;
background-color: transparent;
border: none;
outline: none;
width: 100%;
margin: 15px 0;
padding: 0;
}
input[type=range]:focus {
outline: none;
}
input[type=range]+.thumb {
position: absolute;
top: 10px;
left: 0;
border: none;
height: 0;
width: 0;
border-radius: 50%;
background-color: #26a69a;
margin-left: 7px;
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
input[type=range]+.thumb .value {
display: block;
width: 30px;
text-align: center;
color: #26a69a;
font-size: 0;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
input[type=range]+.thumb.active {
border-radius: 50% 50% 50% 0;
}
input[type=range]+.thumb.active .value {
color: #fff;
margin-left: -1px;
margin-top: 8px;
font-size: 10px;
}
input[type=range] {
-webkit-appearance: none;
}
input[type=range]::-webkit-slider-runnable-track {
height: 3px;
background: #c2c0c2;
border: none;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
border: none;
height: 14px;
width: 14px;
border-radius: 50%;
background-color: #26a69a;
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
margin: -5px 0 0 0;
-webkit-transition: .3s;
transition: .3s;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #ccc;
}
input[type=range] {
/* fix for FF unable to apply focus style bug */
border: 1px solid white;
/*required for proper track sizing in FF*/
}
input[type=range]::-moz-range-track {
height: 3px;
background: #ddd;
border: none;
}
input[type=range]::-moz-range-thumb {
border: none;
height: 14px;
width: 14px;
border-radius: 50%;
background: #26a69a;
margin-top: -5px;
}
input[type=range]:-moz-focusring {
outline: 1px solid #fff;
outline-offset: -1px;
}
input[type=range]:focus::-moz-range-track {
background: #ccc;
}
input[type=range]::-ms-track {
height: 3px;
background: transparent;
border-color: transparent;
border-width: 6px 0;
/*remove default tick marks*/
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #777;
}
input[type=range]::-ms-fill-upper {
background: #ddd;
}
input[type=range]::-ms-thumb {
border: none;
height: 14px;
width: 14px;
border-radius: 50%;
background: #26a69a;
}
input[type=range]:focus::-ms-fill-lower {
background: #888;
}
input[type=range]:focus::-ms-fill-upper {
background: #ccc;
}

<p class="range-field">
<i class="material-icons prefix"></i>
<input type="range" id="range1" min="0" max="10" value="0" />
</p>
&#13;
问题是当沿着轨道拖动拇指弹出值不是直接在拇指上方here
沿着轨道拖动拇指很好,值也相应地改变,但是显示的值不是居中的。
提供的CSS代码来自物化css,我不确定是否需要它或是否有用。
如果需要任何其他信息,请告诉我们!
谢谢:)