Please take a look at the following CodePen. There you can see my custom range input. I want the tick positions of the slider to be shown and for that I added the datalist:
fieldset {
border: 2px solid #48530D;
padding-top: 27px;
padding-right: 20px;
padding-bottom: 0px;
padding-left: 20px;
}
input[type=range] {
-webkit-appearance: none;
width: 100%;
margin: 4px 0;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 8px;
cursor: pointer;
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0), 0px 0px 0px rgba(13, 13, 13, 0);
background: #a4b162;
border-radius: 0px;
border: 1px solid rgba(0, 0, 0, 0);
}
input[type=range]::-webkit-slider-thumb {
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
border: 1px solid #000000;
height: 16px;
width: 16px;
border-radius: 0px;
background: #48530d;
cursor: pointer;
-webkit-appearance: none;
margin-top: -5px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #a6b365;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 8px;
cursor: pointer;
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0), 0px 0px 0px rgba(13, 13, 13, 0);
background: #a4b162;
border-radius: 0px;
border: 1px solid rgba(0, 0, 0, 0);
}
input[type=range]::-moz-range-thumb {
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
border: 1px solid #000000;
height: 16px;
width: 16px;
border-radius: 0px;
background: #48530d;
cursor: pointer;
}
input[type=range]::-ms-track {
width: 100%;
height: 8px;
cursor: pointer;
background: transparent;
border-color: transparent;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #a2af5f;
border: 1px solid rgba(0, 0, 0, 0);
border-radius: 0px;
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0), 0px 0px 0px rgba(13, 13, 13, 0);
}
input[type=range]::-ms-fill-upper {
background: #a4b162;
border: 1px solid rgba(0, 0, 0, 0);
border-radius: 0px;
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0), 0px 0px 0px rgba(13, 13, 13, 0);
}
input[type=range]::-ms-thumb {
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
border: 1px solid #000000;
height: 16px;
width: 16px;
border-radius: 0px;
background: #48530d;
cursor: pointer;
height: 8px;
}
input[type=range]:focus::-ms-fill-lower {
background: #a4b162;
}
input[type=range]:focus::-ms-fill-upper {
background: #a6b365;
}
<fieldset>
<form>
<input max="6" min="1" step="1" name="question_three" type="range" list="question_three_list" />
<datalist id="question_three_list">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
</datalist>
</form>
</fieldset>
But unfortunately nothing is showing up. What I wanted to achieve is the following (ugly example created in MS Paint, but I guess you will get what I mean):
So how can I achieve that?