Content · Web Development · HTML

HTML input type="range": Slider Controls

Range lets people choose an approximate number from a defined interval by moving a slider. It is good for volume or preference levels when exact typing is not required.

3 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Range lets people choose an approximate number from a defined interval by moving a slider. It is good for volume or preference levels when exact typing is not required. We will keep the example small, so you can see how the fields work without building a whole application first.

What You Need to Know


The current numeric value may not be visible unless you display it separately. Use clear labels, min, max, and step, and remember that live output updates need JavaScript.

A range slider does not automatically display its current number. Live numeric updates need JavaScript, and a visible label is still essential.

A form is like a question sheet. The label asks the question, the control holds the answer, and the name tells the receiving application what that answer is called.

Example: See It in Action


Here is a simple example to experiment with. Type it, save the file, and check what the browser displays.

This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.

<form action="/preferences" method="get">
    <label for="volume">Volume (0 to 100)</label>
    <input type="range" id="volume" name="volume" min="0" max="100" step="10" value="50">
    <button type="submit">Save choice</button>
</form>

Let’s Understand the Example


  • Input creates a form control. Its type decides whether people type text, choose a date, move a slider and more.
  • Label tells people what a control is for. For connects the label to the control with the matching id.
  • Min sets the lower allowed value for suitable numeric and date controls.
  • Max sets the upper allowed value for suitable numeric and date controls.
  • Step sets permitted intervals for suitable numeric, date and time controls.
  • Value is the value represented or submitted by a control or data element.

The browser can submit values with keys such as volume. A control without a name normally contributes no entry. Whether the submission produces a result depends on the action URL and the server behind it.

What Should You See?


You should see controls for Volume (0 to 100). The example uses an input of type range and sends a GET request when submitted. If the action points to a missing server endpoint, the browser cannot complete the task.

Choose one field and predict its submitted name and value. Then change the value and check whether the browser accepts it. Do not assume that a working-looking form has a real server behind it.

Try It Yourself


  1. Change the step to 5 and compare the selectable positions.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Assuming a range slider automatically displays its exact value or updates a nearby output.
  • Client-side HTML validation is a helpful first check, not a security boundary. A real receiving application must validate the values again.

Key Takeaways


  • Range lets people choose an approximate number from a defined interval by moving a slider.
  • Input creates a form control. Its type decides whether people type text, choose a date, move a slider and more.
  • A range slider does not automatically display its current number. Live numeric updates need JavaScript, and a visible label is still essential.
Share this resourceSend this page to someone who may find it useful.