这是一款JS和CSS蓝色发光范围选择器效果,该范围选择器使用蓝色色调,带淡淡的发光效果,非常有科技感,效果非常炫酷。
使用方法
HTML代码
<div> <label for="range-input">Custom Range Input</label> <div class="range-control"> <div class="range-slider-container"> <input type="range" id="range-input" min="0" max="800"> </div> <div class="range-value-container"> <span id="range-input-value" class="range-value">400</span> </div> </div> </div>
CSS代码
label { display: block; margin-bottom: 4px; } .range-control { align-items: center; background: radial-gradient(60% 17% at 50% -2%, #96dded 0%, transparent 100%) no-repeat, 0px 0px/75% 100%, radial-gradient(60% 17% at 50% 102%, #96dded 0%, transparent 100%) no-repeat, 0px 0px/75% 100%, linear-gradient(rgba(94, 100, 111, 0.25) 3px, transparent 3px) 8px 4px/16px 16px, linear-gradient(to right, rgba(94, 100, 111, 0.25) 3px, transparent 3px) 8px 4px/16px 16px, rgba(43, 44, 43, 0.75); border-bottom: 2px solid #b0e5fb; border-top: 2px solid #b0e5fb; display: flex; height: 45px; justify-content: space-between; padding-left: 8px; position: relative; } .range-control:before, .range-control:after { background-color: rgba(255, 255, 255, 0.7); content: ""; height: 41px; position: absolute; width: 2px; } .range-control:before { left: 0; top: 0; } .range-control:after { right: 0; top: 0; } .range-control .range-slider-container { align-items: center; display: flex; } .range-control .range-slider-container:before, .range-control .range-slider-container:after { background-color: rgba(255, 255, 255, 0.7); content: ""; height: 14px; width: 2px; } .range-control .range-slider-container:before { left: 5px; margin-right: 1px; top: 0; } .range-control .range-slider-container:after { margin-left: 1px; right: 0; top: 0; } .range-control .range-value-container { align-items: center; color: #b0e5fb; display: flex; flex-grow: 1; justify-content: center; min-width: 86px; text-shadow: 0px 0px 15px rgba(37, 222, 232, 0.8); } input[type=range] { -moz-appearance: none; appearance: none; background: transparent; cursor: pointer; transition: opacity 300ms ease-in-out; -webkit-appearance: none; width: 280px; } input[type=range]:focus { outline: none; } input[type=range]:disabled { opacity: 50%; } input[type=range]::-moz-range-track { background-color: #b0e5fb; background: linear-gradient(to right, white 3%, #b0e5fb 3%, #b0e5fb 97%, white 97%); height: 3px; } input[type=range]::-webkit-slider-runnable-track { background-color: #b0e5fb; background: linear-gradient(to right, white 3%, #b0e5fb 3%, #b0e5fb 97%, white 97%); height: 3px; } input[type=range]::-moz-range-thumb { background-color: rgba(255, 255, 255, 0.5); border: 1px solid white; border-radius: 0; height: 12px; -moz-transition: all 200ms ease-in-out; transition: all 200ms ease-in-out; width: 5px; } input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; background-color: rgba(255, 255, 255, 0.5); border: 1px solid white; border-radius: 0; height: 13px; margin-top: -5px; -webkit-transition: all 200ms ease-in-out; transition: all 200ms ease-in-out; width: 7px; } input[type=range]:focus::-moz-range-thumb { background-color: rgba(109, 184, 219, 0.5); border: 1px solid #b0e5fb; } input[type=range]:focus::-webkit-slider-thumb { background-color: rgba(109, 184, 219, 0.5); border: 1px solid #b0e5fb; } a { color: #b0e5fb; margin: 25px 0; text-decoration: none; transition: color 350ms ease; } a:link, a:visited { color: #b0e5fb; } a:hover, a:focus { color: #5acafa; } a:active { color: #5d95c9; }
codepen网址:https://codepen.io/jdillon/pen/zYmGEWY