bootstrap4.css
.custom-range {
width: 100%;
height: calc(1rem + 0.4rem);
padding: 0;
background-color: transparent;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
bootstrap4.css
.custom-range:focus {
outline: none;
}
bootstrap4.css
.custom-range:focus::-webkit-slider-thumb {
box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
bootstrap4.css
.custom-range:focus::-moz-range-thumb {
box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
bootstrap4.css
.custom-range:focus::-ms-thumb {
box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
bootstrap4.css
.custom-range::-moz-focus-outer {
border: 0;
}
bootstrap4.css
.custom-range::-webkit-slider-thumb {
width: 1rem;
height: 1rem;
margin-top: -0.25rem;
background-color: #007bff;
border: 0;
border-radius: 1rem;
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;
}
bootstrap4.css
@media (prefers-reduced-motion: reduce) {
.custom-range::-webkit-slider-thumb {
transition: none;
}
}
bootstrap4.css
.custom-range::-webkit-slider-thumb:active {
background-color: #b3d7ff;
}
bootstrap4.css
.custom-range::-webkit-slider-runnable-track {
width: 100%;
height: 0.5rem;
color: transparent;
cursor: pointer;
background-color: #dee2e6;
border-color: transparent;
border-radius: 1rem;
}
bootstrap4.css
.custom-range::-moz-range-thumb {
width: 1rem;
height: 1rem;
background-color: #007bff;
border: 0;
border-radius: 1rem;
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;
}
bootstrap4.css
@media (prefers-reduced-motion: reduce) {
.custom-range::-moz-range-thumb {
transition: none;
}
}
bootstrap4.css
.custom-range::-moz-range-thumb:active {
background-color: #b3d7ff;
}
bootstrap4.css
.custom-range::-moz-range-track {
width: 100%;
height: 0.5rem;
color: transparent;
cursor: pointer;
background-color: #dee2e6;
border-color: transparent;
border-radius: 1rem;
}
bootstrap4.css
.custom-range::-ms-thumb {
width: 1rem;
height: 1rem;
margin-top: 0;
margin-right: 0.2rem;
margin-left: 0.2rem;
background-color: #007bff;
border: 0;
border-radius: 1rem;
transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
appearance: none;
}
bootstrap4.css
@media (prefers-reduced-motion: reduce) {
.custom-range::-ms-thumb {
transition: none;
}
}
bootstrap4.css
.custom-range::-ms-thumb:active {
background-color: #b3d7ff;
}
bootstrap4.css
.custom-range::-ms-track {
width: 100%;
height: 0.5rem;
color: transparent;
cursor: pointer;
background-color: transparent;
border-color: transparent;
border-width: 0.5rem;
}
bootstrap4.css
.custom-range::-ms-fill-lower {
background-color: #dee2e6;
border-radius: 1rem;
}
bootstrap4.css
.custom-range::-ms-fill-upper {
margin-right: 15px;
background-color: #dee2e6;
border-radius: 1rem;
}
bootstrap4.css
.custom-range:disabled::-webkit-slider-thumb {
background-color: #adb5bd;
}
bootstrap4.css
.custom-range:disabled::-webkit-slider-runnable-track {
cursor: default;
}
bootstrap4.css
.custom-range:disabled::-moz-range-thumb {
background-color: #adb5bd;
}
bootstrap4.css
.custom-range:disabled::-moz-range-track {
cursor: default;
}
bootstrap4.css
.custom-range:disabled::-ms-thumb {
background-color: #adb5bd;
}
■フォーム:form-group:コンポーネント:カスタムレンジ入力
<form>
<div class="form-group mb-5">
<label for="formControlRange">レンジ入力の例</label>
<input type="range" class="form-control-range" id="defaultRange"> </div>
<div class="form-group mb-5">
<label for="customRange1">カスタムレンジ入力の例</label>
<input type="range" class="custom-range" id="customRange1"> </div>
<div class="form-group mb-5">
<label for="customRange2">カスタムレンジ入力の例(min="0",max="5")</label>
<input type="range" class="custom-range" min="0" max="5" id="customRange2"> </div>
<div class="form-group mb-5">
<label for="customRange3">カスタムレンジ入力の例(step="0.5")</label>
<input type="range" class="custom-range" min="0" max="5" step="0.5" id="customRange3"> </div>
</form>