Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Custom Slider</title> <style> .slider-container { display: flex; align-items: center; gap: 10px; } #slider { width: 200px; } </style> </head> <body> <div class="slider-container"> <input type="range" id="slider" min="0" max="100" value="50"> <span id="slider-value">50</span> </div> <script> document.getElementById('slider').addEventListener('input', function() { document.getElementById('slider-value').textContent = this.value; }); </script> </body> </html>