gpt4 book ai didi

html - 如何让 slider 悬停成一个圆圈并摆脱 slider 上方形成的线?

转载 作者:行者123 更新时间:2023-11-28 14:06:03 25 4
gpt4 key购买 nike

我目前有一个带悬停的 slider ,但是有没有办法让悬停变成一个在所有浏览器中都显示为圆的圆圈?还有一种方法可以将 slider 的形状从矩形更改为直线吗?我还尝试删除 slider 上方出现的随机线,但似乎无法删除它,是否有明显的我遗漏的东西?

谢谢!

#container {
padding: 300px 500px;
}

#frequencySlider {
margin-top: 1px;
width: 100%;
}

#frequencyLabel {
margin-top: 1px;
}

#toggleAudio {
padding: 10px 20px;
height: center;
width: center;
font-size: 15px;
background: #939393;
color: white;
opacity: 0.7;
}


/* Slider */

.slider {
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 8px;
background: #908e8e;
opacity: 0.2;
-webkit-transition: .3s;
transition: opacity .3s;
}

.slider:hover {}

.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 12px;
height: 20px;
background: #0b38b4;
cursor: pointer;
}

.slider::-moz-range-thumb {
width: 12px;
height: 20px;
background: #0b38b4;
cursor: pointer;
}
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
<div id="container">

<button id="toggleAudio">
Click Here
</button>
<hr>
<input type="range" min="100" max="4000" value="2000" step="1" class="slider" id="frequencySlider">
<br>
<p id="frequencyLabel">Frequency: 2000 Hz</p>
</div>
</body>

</html>

最佳答案

也适用于 IE11 -> full example

#frequencySlider {
margin-top: 1px;
width: 100%;
}

#frequencyLabel {
margin-top: 1px;
}

#toggleAudio {
padding: 10px 20px;
height: center;
width: center;
font-size: 15px;
background: #939393;
color: white;
opacity: 0.7;
}


/* Slider */

input[type=range] {
width: 100%;
height: 25px;
margin: 10px 0;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: transparent;
}

input[type=range]:focus {
outline: none;
}

input[type=range]::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #f00;
border-radius: 1px;
border: 0px solid #000;
color: transparent;
}

input[type=range]::-ms-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #f00;
border-radius: 1px;
border: 0px solid #000;
color: transparent;
}

input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #f00;
border-radius: 1px;
border: 0px solid #000;
color: transparent;
}

input[type=range]::-moz-range-thumb {
border: 1px solid #000;
height: 18px;
width: 18px;
border-radius: 50%;
background: rgb(33, 150, 243);
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin-top: -7px;
}

input[type=range]::-ms-thumb {
border: 1px solid #000;
height: 18px;
width: 18px;
border-radius: 50%;
background: rgb(33, 150, 243);
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin-top: -7px;
}

input[type=range]::-webkit-slider-thumb {
border: 1px solid #000;
height: 18px;
width: 18px;
border-radius: 50%;
background: rgb(33, 150, 243);
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin-top: -7px;
}


/* fix for IE11 */

input[type=range]::-ms-thumb {
height: 15px;
width: 15px;
margin-top: 0;
background: rgb(33, 150, 243);
}
<div id="container">
<button id="toggleAudio">
Click Here
</button>

<label id="range" class="range">
<input type="range" min="100" max="4000" value="2000" step="1" id="frequencySlider">
</label>
<br>
<p id="frequencyLabel">Frequency: 2000 Hz</p>
</div>

关于html - 如何让 slider 悬停成一个圆圈并摆脱 slider 上方形成的线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57223364/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com