Dynamic Neon Glow Range Slider
See the Pen Dynamic Neon Glow Range Slider.
Tech & Dependencies
Features
- ✓ Skeuomorphism
- ✓ Dynamic Shadow Casting
- ✓ CSS @property
- ✓ Cross-browser Track Styling
Browser Support
Core
This is a Dynamic Neon Glow Range Slider. It re-imagines a standard HTML range input as a high-fidelity, skeuomorphic control with interactive lighting. Its function is to provide an immersive user experience where the slider’s track illuminates with a neon glow that intensifies, and its drop shadow physically shifts, based on the thumb’s position.
Specs
- Weight: ~2 KB. No external dependencies.
- Performance: High. The interaction logic is handled by a minimal inline
oninputscript that updates a single CSS custom property. All visual effects are rendered by the browser’s CSS engine. - Theming / Customization: The neon glow color (
--color) is defined as an inline style and can be easily customized per instance. The skeuomorphic shading is built with layeredbox-shadowandradial-gradientbackgrounds. - Responsiveness: Fluid. Built with relative
emunits, allowing the component to scale naturally based on itsfont-size. - Graceful Degradation: The component uses vendor prefixes (
::-webkit-slider-thumb,::-moz-range-track) for maximum browser compatibility. In browsers that don’t support@property, the glow will snap to its final state rather than transitioning smoothly, but the slider remains fully functional.
Anatomy
The component uses a “pseudo-element-first” approach to style the native <input>.
- HTML (The Skeleton): A single, standard
<input type="range">. An inlineoninputattribute provides the link between the input’s value and the CSS. - CSS (The Skin): The native
appearanceis disabled. The track and thumb are styled independently using::-webkit-slider-runnable-trackand::-webkit-slider-thumb(with Firefox fallbacks). The skeuomorphic, textured thumb is created by stacking multipleradial-gradientandrepeating-linear-gradientbackgrounds. - JS (The Nervous System): A single line of inline JavaScript (
oninput="this.style='--val:'+this.value") that acts as a bridge, passing the input’s internal state to a CSS custom property (--val).
Logic
The standout technical feature is the Value-Driven Shadow and Glow Calculation.
.glow::before {
box-shadow:
0 0 calc(1em + 0.001em * var(--val)) calc(0.1em + 0.00025em * var(--val)) var(--c);
}
.glow::-webkit-slider-thumb {
box-shadow:
/* ... */
calc(0.0125em * var(--val)) calc(0.005em * var(--val)) calc(0.02em * var(--val)) calc(-0.01em * var(--val)) #000a;
}
Instead of a static shadow, the box-shadow offsets and blur radius are calculated dynamically based on the --val custom property (which ranges from 0 to 100). As the user drags the slider to the right, the value of --val increases. This simultaneously makes the outer glow box-shadow larger and more intense while also shifting the box-shadow on the thumb itself. This creates a realistic illusion that the “light” from the track is physically casting a longer, more pronounced shadow on the thumb as it gets “brighter.”
Feel
Tactile, physical, and responsive. The multi-layered gradients and shadows give the thumb a textured, three-dimensional feel. The way the neon glow intensifies and the shadow shifts in real-time provides immediate, satisfying feedback that feels directly connected to the user’s input. It transforms a simple form element into an engaging, high-end hardware simulation.


