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.
Attribute | Descriptions |
---|---|
Value | Set default value of range, if any. |
Min | Set minimum value of the range if any. Default minimum value is 0. |
Max | Set maximum value of the range if any. Default maximum value is 100. |
Step | Set step in a given range, default value is 1 and only allowing integer number. |
List | Datalist can be incorporated into range if browser support. |
As of writing, only few browsers provide support for this new feature.
Syntax
Syntax
Syntax
Example
See Live Example