range-input {
position: relative;
display: flex;
height: 18px;
width: 130px;
margin: 2px;
font: inherit;
line-height: 16px;
overflow: visible;
}
/* Disabled inputs are greyed out */
range-input[disabled] {
filter: grayscale(1);
}
range-input::before {
content: '';
display: block;
position: absolute;
top: 8px;
left: 0;
width: 100%;
height: 2px;
border-radius: 1px;
box-shadow: 0 -0.5px 0 rgba(0, 0, 0, 0.3),
inset 0 0.5px 0 rgba(255, 255, 255, 0.2), 0 0.5px 0 rgba(255, 255, 255, 0.3);
background: linear-gradient(#34b9eb, #218ab1) 0 / var(--value-percent, 0%)
100% no-repeat #eee;
}
.input {
position: relative;
width: 100%;
padding: 0;
margin: 0;
opacity: 0;
}
.thumb {
pointer-events: none;
position: absolute;
bottom: 3px;
left: var(--value-percent, 0%);
margin-left: -6px;
background: url('data:image/svg+xml,')
center no-repeat #34b9eb;
border-radius: 50%;
width: 12px;
height: 12px;
box-shadow: 0 0.5px 2px rgba(0, 0, 0, 0.3);
}
.thumb-wrapper {
position: absolute;
left: 6px;
right: 6px;
bottom: 0;
height: 0;
overflow: visible;
}
.value-display {
background: url('data:image/svg+xml,')
top center no-repeat;
position: absolute;
box-sizing: border-box;
left: var(--value-percent, 0%);
bottom: 3px;
width: 32px;
height: 62px;
text-align: center;
padding: 8px 3px 0;
margin: 0 0 0 -16px;
filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
transform-origin: 50% 90%;
opacity: 0.0001;
transform: scale(0.2);
color: #fff;
font: inherit;
font-size: calc(100% - var(--value-width, 3) / 5 * 0.2em);
text-overflow: clip;
text-shadow: 0 -0.5px 0 rgba(0, 0, 0, 0.4);
transition: all 200ms ease;
transition-property: opacity, transform;
will-change: transform;
pointer-events: none;
overflow: hidden;
}
.touch-active + .thumb-wrapper .value-display {
opacity: 1;
transform: scale(1);
}
.touch-active + .thumb-wrapper .thumb {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}