Skip to content

Instantly share code, notes, and snippets.

@bmbrands
Last active October 28, 2019 13:03
Show Gist options
  • Save bmbrands/6ef209c26d03178ff3bf2bcafed4c805 to your computer and use it in GitHub Desktop.
Save bmbrands/6ef209c26d03178ff3bf2bcafed4c805 to your computer and use it in GitHub Desktop.
Custom CSS for HTML sliders
@media (min-width: 800px) {
.slider-item {
display: flex;
align-items: center;
margin-bottom: 0.5rem; }
.slider-item .slider-range {
flex: 0 0 220px;
max-width: 220px;
margin-right: 1rem; }
.slider-item .slider-label {
flex: 1 1 auto;
margin-bottom: 0; } }
input[type=range] {
-webkit-appearance: none;
width: 100%;
margin: 0px 0;
overflow: hidden;
height: 60px;
box-sizing: content-box; }
input[type=range]:focus {
outline: none; }
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 60px;
cursor: pointer;
box-shadow: 0;
background: #0f0;
border-radius: 0px;
border: 0; }
input[type=range]::-webkit-slider-thumb {
box-shadow: 0;
border: 1px solid rgba(0, 0, 0, 0);
height: 60px;
width: 10px;
border-radius: 0px;
background: #434343;
cursor: pointer;
-webkit-appearance: none;
margin-top: -0.2px;
box-shadow: -200px 0 0 200px red; }
input[type=range]:focus::-webkit-slider-runnable-track {
background: #1aff1a; }
@-moz-document url-prefix() {
input[type=range] {
height: 60px; } }
input[type=range]::-moz-range-track {
width: 100%;
height: 60px;
cursor: pointer;
box-shadow: 0;
background: #0f0;
border-radius: 0px;
border: 0; }
input[type=range]::-moz-range-thumb {
box-shadow: 0;
border: 1px solid rgba(0, 0, 0, 0);
height: 60px;
width: 10px;
border-radius: 0px;
background: #434343;
cursor: pointer;
box-shadow: -200px 0 0 200px red; }
input[type=range]::-ms-track {
width: 100%;
height: 60px;
cursor: pointer;
background: transparent;
border-color: transparent;
color: transparent; }
input[type=range]::-ms-fill-lower {
background: #0f0;
border: 0;
border-radius: 0px;
box-shadow: 0; }
input[type=range]::-ms-fill-upper {
background: red;
border: 0;
border-radius: 0px;
box-shadow: 0; }
input[type=range]::-ms-thumb {
box-shadow: 0;
border: 1px solid rgba(0, 0, 0, 0);
width: 10px;
border-radius: 0px;
background: #434343;
cursor: pointer;
height: 60px; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment