Styling HTML5 Range slider Input CSS

Here have nice way to Styling HTML5 range slider input field with css. you can see the below demo for html5 slider

Demo

The HTML Markup

First we creating html structure for HTML5 slider. the html structure is as follows:

<input type="range" min="0" max="50" value="5" step="5" onchange="rangevalue.value=value" />
<output id="rangevalue"></output>

The CSS

We are done the html structure for html5 range slider. So let's start the write css for html5 slider input field, The css is as follows:

<style>
    input[type='range'] {
        -webkit-appearance: none;
        appearance: none;
        -moz-appearance: none;
        border-radius: 5px;
        box-shadow: inset 1px 1px 1px rgba(000,000,000,0.25);
        background-color: #FFF;
        height: 8px;
        vertical-align: middle;
        width: 200px;
    }
    input[type=range]::-webkit-slider-runnable-track {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 5px;
        box-shadow: inset 1px 1px 1px rgba(000,000,000,0.25);
        background-color: #FFF;
        height: 10px;
        vertical-align:middle;
        border:solid 1px rgba(0,0,0,0.25);
    }
    input[type='range']::-webkit-slider-thumb {
        -webkit-appearance: none;
        border-radius: 10px;
        background-color: #FFF;
        box-shadow:inset 0px 1px 0px rgba(000,000,000,0.5);
        border: 1px solid #999;
        height: 20px;
        width: 7px;
        vertical-align:middle;
        margin-top: -6px;
    }
    input[type='range']::-moz-range-track {
        -moz-appearance: none;
        border-radius: 5px;
        box-shadow: inset 1px 1px 1px rgba(000,000,000,0.25);
        background-color: #FFF;
        height: 8px;
        border:solid 1px rgba(0,0,0,0.25);
        vertical-align:middle;
        margin:0;
        padding:0;
    }
    input[type='range']::-moz-range-thumb {
        -moz-appearance: none;
        border-radius: 10px;
        background-color: #FFF;
        box-shadow:inset 0px 1px 0px rgba(000,000,000,0.5);
        border: 1px solid #999;
        height: 20px;
        width: 5px;
    }
</style>

I have tested the demo, it's working good in latest browser Of Firefox, Chrome, Safari, Opera etc...

Let's, you can try you self and download the source code from the below links.

Try Your Self Download

  • Share
  • Copyright 2016 by WebiBeris.com. All Rights Reserved.