【发布时间】:2021-07-12 08:41:15
【问题描述】:
我正在构建一个包含滑块的网站,但我看到了一些我无法弄清楚的非常奇怪的行为。在 Firefox 上,似乎有一个我无法摆脱的白色背景。我找不到它的样式,也无法更改它。代码按预期在 chrome 上运行。
HTML
<input type="range" id="costSlider" name="costSlider" min="0" max="1000" step="10">
CSS
input[type="range"] {
-webkit-appearance: none;
width: 60%;
margin-bottom: 20px;
}
input[type="range"]:focus {
outline: none;
}
/* Slider Bar */
input[type="range"]::-webkit-slider-runnable-track {
height: 6px;
}
input[type="range"]::-moz-range-track {
background: red;
height: 6px;
}
/* Slider Thumb / Circle */
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
height: 17px;
width: 17px;
background: #4fc971;
margin-top: -5px;
border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
height: 17px;
width: 17px;
background: #4fc971;
margin-top: -5px;
border-radius: 50%;
}
input[type="range"]::-webkit-slider-thumb:hover {
background: #4fc971;
box-shadow: 0 0 0 8px rgba(79, 201, 113, .5);
}
input[type="range"]::-moz-range-thumb:hover {
background: #4fc971;
box-shadow: 0 0 0 8px rgba(79, 201, 113, .5);
}
【问题讨论】:
标签: css firefox background-color input-type-range