<input type="range" min="0" max="100" step="1" value="20">
<input type="range" min="0" max="100" step="1" style="--c: lightblue;--l: 6px;--g:12px;">
<input type="range" min="0" max="100" step="1" value="70" style="--c: red;--l: 4px;">
input {
--c: orange; /* active color */
--g: 8px; /* the gap */
--l: 5px; /* line thickness*/
--s: 30px; /* thumb size*/
width: 400px;
height: var(--s); /* needed for Firefox*/
--_c: color-mix(in srgb, var(--c), #000 var(--p,0%));
-webkit-appearance :none;
-moz-appearance :none;
appearance :none;
background: none;
cursor: pointer;
overflow: hidden;
}
input:focus-visible,
input:hover{
--p: 25%;
}
input:active,
input:focus-visible{
--_b: var(--s)
}
/* chromium */
input[type="range" i]::-webkit-slider-thumb{
height: var(--s);
aspect-ratio: 1;
border-radius: 50%;
box-shadow: 0 0 0 var(--_b,var(--l)) inset var(--_c);
border-image: linear-gradient(90deg,var(--_c) 50%,#ababab 0) 0 1/calc(50% - var(--l)/2) 100vw/0 calc(100vw + var(--g));
-webkit-appearance: none;
appearance: none;
transition: .3s;
}
/* Firefox */
input[type="range"]::-moz-range-thumb {
height: var(--s);
width: var(--s);
background: none;
border-radius: 50%;
box-shadow: 0 0 0 var(--_b,var(--l)) inset var(--_c);
border-image: linear-gradient(90deg,var(--_c) 50%,#ababab 0) 0 1/calc(50% - var(--l)/2) 100vw/0 calc(100vw + var(--g));
-moz-appearance: none;
appearance: none;
transition: .3s;
}
@supports not (color: color-mix(in srgb,red,red)) {
input {
--_c: var(--c);
}
}
/**/
body {
margin: 0;
min-height: 100vh;
display: grid;
gap: 40px;
place-content: center;
background: repeating-linear-gradient(-45deg, #fff 0 20px, #f9f9f9 0 40px)
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.