<section>
<div>
<h1>CSS3 minimal input range</h1>
<input type="range" />
</div>
</section>
// from https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/
// * * * COLORS * * *
@color__fill: #16a085; // green
@font-size: 16px; // <--- change the font size to change the size
// dark version
//@color__default: rgba(0,0,0,.2);
//@color__hover: rgba(0,0,0,.3);
//@color__active: rgba(0,0,0,.5);
// light version
@color__default: rgba(255,255,255,.5);
@color__hover: rgba(255,255,255,.7);
@color__active: rgba(255,255,255,1);
input[type=range] {
box-sizing: border-box;
font-size: @font-size;
line-height: 1;
height: 2em;
background-color: transparent;
cursor: pointer;
// * * * RESET * * *
appearance: none;
width: 100%;
&::slider-thumb {
appearance: none;
}
&:focus {
outline: none;
}
&::track {
width: 100%;
cursor: pointer;
background: transparent;
border-color: transparent;
color: transparent;
}
// * * * TRUMP * * *
.mx-trange-trump(){
width: 2em;
height: 2em;
margin-top: 0;
background-color: @color__fill;
border-radius: 1em;
border: 2px solid @color__default;
cursor: pointer;
}
&::slider-thumb {
appearance: none;
.mx-trange-trump();
}
&::range-thumb {
.mx-trange-trump();
}
&::thumb {
.mx-trange-trump();
}
&:hover{
&::slider-thumb { border-color: @color__hover; }
&::range-thumb { border-color: @color__hover; }
&::thumb { border-color: @color__hover; }
}
//&:focus,
&:active{
&::slider-thumb { border-color: @color__active; }
&::range-thumb { border-color: @color__active; }
&::thumb { border-color: @color__active; }
}
// * * * TRACK * * *
.mx-range-track(){
width: 100%;
cursor: pointer;
height: 1em;
border-bottom: 2px solid @color__default;
background-color: transparent;
}
&::slider-runnable-track {
.mx-range-track();
}
&:focus::slider-runnable-track {
}
&::range-track {
.mx-range-track()
}
&::track {
background: transparent;
border-color: transparent;
color: transparent;
}
&::fill-lower {
}
&:focus::fill-lower {
}
&::fill-upper {
}
&:focus::fill-upper {
}
}
// just for the demo :)
section{
display: flex;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: @color__fill;
div{
margin: auto;
width: 80%;
}
h1{
font-family: "Helvetica Neue",Helvetical,Arial,sans-serif;
font-weight: 300;
margin-bottom: 100px;
text-align: center;
font-size: 42px;
color: rgba(0,0,0,.3);
}
}
View Compiled
/* Your princess is in another castel
__▒▒▒▒▒
—-▒▒▒▒▒▒▒▒▒
—–▓▓▓░░▓░
—▓░▓░░░▓░░░
—▓░▓▓░░░▓░░░
—▓▓░░░░▓▓▓▓
——░░░░░░░░
—-▓▓▒▓▓▓▒▓▓
–▓▓▓▒▓▓▓▒▓▓▓
▓▓▓▓▒▒▒▒▒▓▓▓▓
░░▓▒░▒▒▒░▒▓░░
░░░▒▒▒▒▒▒▒░░░
░░▒▒▒▒▒▒▒▒▒░░
—-▒▒▒ ——▒▒▒
–▓▓▓———-▓▓▓
▓▓▓▓———-▓▓▓▓
*/
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.