Showing posts with label range-slider. Show all posts
Showing posts with label range-slider. Show all posts

Apr 5, 2012

Range Slider | Range Input Using HTML5 & CSS3 | NO JAVASCRIPT

A regular website coder will face a situation where they will have to use a range slider to fulfill some requirements. I regularly used JQuery UI range slider, but thanks to HTML5 that they made us our life easy. HTML5 has a new input tag, its type is defined as "range". Using this, a range slider will be formed, but for now this is only supported by -webkit- supported browsers. You can read more on new HTML5 input tags over here.

Range Slider

In todays tutorial we will explore range slider.

Basic syntax:

[html]
<input type="range" id="rangeinput" value="50"/>
[/html]

You can edit the CSS and change the slider icon.

[css]
input[type="range"] {
-webkit-appearance: none;
background-color: black;
height: 2px;
}

input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
position: relative;
top: -1px;
z-index: 1;
width: 11px;
height: 11px;

-webkit-border-radius: 40px;
-moz-border-radius: 40px;
border-radius: 40px;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ebf1f6), color-stop(50%,#abd3ee), color-stop(51%,#89c3eb), color-stop(100%,#d5ebfb));
}
[/css]

You can check the demo and download the files. Demo will be only supported in WEBKIT browsers