form-range

bootstrap5.css

bootstrap5.css
.form-range {
  width: 100%;
  height: 1.5rem;
  padding: 0;
  background-color: transparent;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
bootstrap5.css
.form-range:focus {
  outline: none;
}
bootstrap5.css
.form-range:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px #fff, 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
bootstrap5.css
.form-range:focus::-moz-range-thumb {
  box-shadow: 0 0 0 1px #fff, 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
bootstrap5.css
.form-range::-moz-focus-outer {
  border: 0;
}
bootstrap5.css
.form-range::-webkit-slider-thumb {
  width: 1rem;
  height: 1rem;
  margin-top: -0.25rem;
  background-color: #0d6efd;
  border: 0;
  border-radius: 1rem;
  -webkit-transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  -webkit-appearance: none;
  appearance: none;
}
bootstrap5.css
@media (prefers-reduced-motion: reduce) {
  .form-range::-webkit-slider-thumb {
    -webkit-transition: none;
    transition: none;
  }
}
bootstrap5.css
.form-range::-webkit-slider-thumb:active {
  background-color: #b6d4fe;
}
bootstrap5.css
.form-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 0.5rem;
  color: transparent;
  cursor: pointer;
  background-color: #dee2e6;
  border-color: transparent;
  border-radius: 1rem;
}
bootstrap5.css
.form-range::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  background-color: #0d6efd;
  border: 0;
  border-radius: 1rem;
  -moz-transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  -moz-appearance: none;
  appearance: none;
}
bootstrap5.css
@media (prefers-reduced-motion: reduce) {
  .form-range::-moz-range-thumb {
    -moz-transition: none;
    transition: none;
  }
}
bootstrap5.css
.form-range::-moz-range-thumb:active {
  background-color: #b6d4fe;
}
bootstrap5.css
.form-range::-moz-range-track {
  width: 100%;
  height: 0.5rem;
  color: transparent;
  cursor: pointer;
  background-color: #dee2e6;
  border-color: transparent;
  border-radius: 1rem;
}
bootstrap5.css
.form-range:disabled {
  pointer-events: none;
}
bootstrap5.css
.form-range:disabled::-webkit-slider-thumb {
  background-color: #adb5bd;
}
bootstrap5.css
.form-range:disabled::-moz-range-thumb {
  background-color: #adb5bd;
}

html bootstrap5 Sample

カスタムレンジ入力最小値と最大値の設定:form-range


  <!-- レンジ上の●をマウスで動かして入力させる -->
  <form>
    <div class="mb-3 mb-5">
      <label for="customRange1">カスタムレンジ入力の例</label>
      <input type="range" class="form-range" id="customRange1">
    </div>
    <div class="mb-3 mb-5">
      <label for="customRange2">0-5まで(min="0",max="5")</label>
      <input type="range" class="form-range" min="0" max="5" id="customRange2">
    </div>
    <!-- step値の変更 0.5刻みにする -->
    <div class="mb-3 mb-5">
      <label for="customRange3">0-5まで、0.5刻み(step="0.5")</label>
      <input type="range" class="form-range" min="0" max="5" step="0.5" id="customRange3">
    </div>
  </form>