使输入类型范围拇指在悬停时显示

时间:2014-07-10 21:59:44

标签: css

快速提问 - 如何为输入类型"范围"制作滑块。出现在滑块上? 这是我到目前为止所做的,但似乎没有效果

滑块的ID是'进度条'。

input[type="range"]{

    -webkit-appearance: none;
    -moz-apperance: none;
    border-radius: 26px;
    height: 3px;
    width: 170px;
    background-color: rgb(74,123,197);
}

    input[type="range"]::-webkit-slider-thumb {
     -webkit-appearance: none;
    background-color: #fff;
    width: 15px;
    height: 15px;
    border-radius: 50%;
visibility: visible;
}

#progressbar:hover input[type="range"]::-webkit-slider-thumb {
visibility: visible;
}

提前非常感谢!!

1 个答案:

答案 0 :(得分:1)

这样的东西?

HTML:

<div id="progressbar">
    <input type="range" min="10" max="100">
</div>

CSS:

input[type="range"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 26px;
    height: 3px;
    width: 170px;
    background-color: rgb(74, 123, 197);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 0;
    height: 0;
}
#progressbar:hover input[type="range"]::-webkit-slider-thumb {
    width:20px;
    height: 20px;
    border: 1px solid blue;
    border-radius: 50%;
    background: #fff;
    box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.6);
}

小提琴:http://jsfiddle.net/Q3hG9/3/

相关问题