About this set
Range sliders whose fill, number, bubble and colour come from CSS rather than JavaScript. Fill and readout without JavaScript shows a download limit in Mbps. Bubble that follows the thumb moves a tip percentage above the thumb. Colour that follows the value turns a CPU limit from green through amber to red as it rises, using oklch(). The technique uses scroll-driven animations: the thumb gets a view timeline with view-timeline on ::-webkit-slider-thumb, the input clips it with overflow: hidden, and a registered integer –val is animated along that timeline from the maximum to the minimum. The live value then drives the gradient fill, a CSS counter that prints the number, the left position of the bubble and the hue. In Chrome and Edge that works with no script at all. Safari and Firefox do not run view timelines on the slider thumb yet, so the set ships a small fallback script: it checks once whether CSS is showing the real value and, if not, switches the animation off and sets –val itself. Firefox also fills the track natively through ::-moz-range-progress. Use it where Chromium matters most and you want the script as a safety net.
What’s included
- Live value, fill, bubble and colour driven by CSS in Chromium
- Registered --val animated by the thumb's view timeline
- Numbers printed with a CSS counter
- Colour ramp from green to red with oklch()
- Fallback script that only acts where the CSS path is missing
Accessibility
Each slider has a visible label, and the input itself exposes its value to assistive technology, so the CSS-printed readout is a visual extra. Arrow keys, Page Up, Page Down, Home and End work as on any range input. Because the input clips its thumb, keyboard focus is an outline around the whole slider rather than a ring on the thumb. The pressed thumb takes a tint that fades in over 150 ms, instantly under prefers-reduced-motion.
Customise it
Set --cs-accent, --cs-track, --cs-thumb and --cs-h on .cs, and keep --min and --max equal to the input's min and max; --unit is the text printed after the number. The Tailwind version puts the same variables in arbitrary properties and --color-cs-track in @theme.






