Content · Web Development · HTML

HTML Range Input: Min, Max, Step, and Output Labels

Range Input: Min, Max, Step, and Output Labels: Min, max, and step set the allowed slider values; output can show the current number through JavaScript. Includes a practical HTML example and an explanation.

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

Imagine asking a friend for some information on a webpage. The field should explain exactly what you need.

What You Need to Know


Min, max, and step set the allowed slider values; output can show the current number through JavaScript.

Try the Example


Take a look at the example. We’ll explain the important lines right below it.

<label for="volume">Volume</label>
<input id="volume" name="volume" type="range" min="0" max="100" step="5" value="40">
<output id="volume-value" for="volume">40</output>
<script>
    const volumeSlider = document.querySelector("#volume");
    volumeSlider.addEventListener("input", () => {
        document.querySelector("#volume-value").value = volumeSlider.value;
    });
</script>

Let’s Read the Code


  • max: Max sets the largest permitted value where that input type supports it.
  • min: Min sets the smallest permitted value where that input type supports it.
  • <label>: The label tells people what the input is for. A matching for/id pair makes the label clickable.
  • <input>: The input is a control. Its type changes the way people enter information.

Read the named elements and attributes together. They explain how the browser connects this feature to the rest of the page.

What Happens in the Browser?


The HTML controls work in the browser, but saving an answer requires the example action path to be handled by a real server.

Where does the answer go? The example uses the submitted name(s) volume. Those names help the receiving server identify each answer. A label is for people; a name attribute is for the form data; an ID connects elements in the page.

Your Turn


Change step to 20 and use arrow keys to move the slider.

Common Beginner Mistakes


  • Copying the example without giving the fields a clear label and a usable name.
  • An output element does not update by itself unless it is connected to logic.

Key Takeaways


  • A control needs a clear label and, when submitted, a meaningful name and value.
  • max: Max sets the largest permitted value where that input type supports it.
  • Remember that HTML form rules help the visitor, but server-side code must decide whether received data is valid.
Share this resourceSend this page to someone who may find it useful.