Styling an input[type="range"]

79 Views Asked by At

Do you think it's possible to goal a design like the picture?

Input

I've tried, but I really can't do it.

I don't know how I can change the options to be closer to the design in the picture. I'm really frustrated because I thought it was going to be easy to do.

I will thank you if you can give me advice to achieve it.

[type='range'] {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 3em;
  background: repeating-linear-gradient(90deg, #ccc 0, #ccc 2px, transparent 0, transparent 1.25em) calc(.5*(1.5em - 2px)) 1.875em/calc(12.5em + 2px) 0.75em no-repeat;
  font: inherit;
}

[type='range'],
[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  border: none;
}

[type='range']::-webkit-slider-runnable-track {
  box-sizing: border-box;
  border: none;
  width: 14em;
  height: 0.25em;
  background: #ccc;
  background-image: linear-gradient(to bottom, #c0c0c0, #afafaf, #9e9e9e, #8e8e8e, #7e7e7e);
  border-radius: .25em;
}

[type='range']::-moz-range-track {
  box-sizing: border-box;
  border: none;
  width: 14em;
  height: 0.25em;
  background: #ccc;
}

[type='range']::-ms-track {
  box-sizing: border-box;
  border: none;
  width: 14em;
  height: 0.25em;
  background: #ccc;
}

[type='range']::-webkit-slider-thumb {
  margin-top: -0.625em;
  box-sizing: border-box;
  border: 1px solid #7e7e7e;
  width: 0.5em;
  height: 1.5em;
  border-radius: 50%;
  background: #ccc;
}

[type='range']::-moz-range-thumb {
  box-sizing: border-box;
  border: 1px solid #7e7e7e;
  width: 0.5em;
  height: 1.5em;
  border-radius: 50%;
  background: #ccc;
}

[type='range']::-ms-thumb {
  margin-top: 0;
  box-sizing: border-box;
  border: 1px solid #7e7e7e;
  width: 0.5em;
  height: 1.5em;
  border-radius: 50%;
  background: #656766;
}

[type='range']::-ms-tooltip {
  display: none;
}

[type='range']:focus {
  outline: none;
}

[type='range']:focus::-webkit-slider-thumb {
  background: #656766;
}

[type='range']:focus::-moz-range-thumb {
  background: #656766;
}

[type='range']:focus::-ms-thumb {
  background: #656766;
}

[type='range']:focus~label span {
  color: #95a;
}

[type='range']~label {
  color: #333;
}

[type='range']~label span {
  color: #ccc;
}

[type='range']~label:after {
  margin: -4px;
  content: ':';
}
<input type="range">

0

There are 0 best solutions below