HTML5 Range Input Type

HTML5 introduced new input type "range" which is quite similar to slider. It represents a numerical value within a given range. When you expect from user to select integer or float value within a given range, use this HTML5 new feature in your web page.

The following code shows how you rate yourself from 1 to 100 by setting the min and max attributes. You have enough flexibility to set the begining point for range using the value attribute.

Syntax

Here is a simple demo.

The Range type input has a few interesting attributes which you may want to learn.

AttributeDescriptions
ValueSet default value of range, if any.
MinSet minimum value of the range if any. Default minimum value is 0.
MaxSet maximum value of the range if any. Default maximum value is 100.
StepSet step in a given range, default value is 1 and only allowing integer number.
ListDatalist can be incorporated into range if browser support.

As of writing, only few browsers provide support for this new feature.

Browser Supports

Syntax

HTML5 Range Input Min and Max Example

Syntax

HTML5 Range Input Min, Max and Step Example

Syntax

HTML5 Range Input with Floating Example

Example

See Live Example