Is there any ideas how to customize bootstrap 4 ranges colors and change blue thumb color to 'gray'?
Input html below.
<p id="slider" class="range-field">
<input
type: "range",
min:"0" max:"3"
class: "custom-range"
value: "2"
disabled: "true"
/>
</p>
To style the range input with CSS you'll need to apply styles to two pseudo-elements: ::-webkit-slider-thumb and ::-webkit-slider-runnable-track . Find out how you can apply custom styling and make the range input more functional and appealing. Contents of the article: CSS selectors for the range input.
Bootstrap slider is an interactive component that lets the user swiftly slide through possible values spread over a desired range. Note: You can also see multi-range sliders, but remember, that they do not work with this plugin.
Try the following code - various vendor-specific classes, use depending on your requirement needs:
.custom-range::-webkit-slider-thumb {
background: gray;
}
.custom-range::-moz-range-thumb {
background: gray;
}
.custom-range::-ms-thumb {
background: gray;
}
Per comments by Astariul and aliawadh980, change the shadow that occurs when the thumb is clicked like this:
-webkit-slider-thumb:active {
background-color: red;
}
-webkit-slider-thumb,
.custom-range:focus::-webkit-slider-thumb,
.custom-range:focus::-moz-range-thumb,
.custom-range:focus::-ms-thumb {
box-shadow: red;
}
If you are using Sass you have to change (overwrite) value of $custom-control-indicator-checked-bg
variable from _variables.scss.
Default value of $custom-control-indicator-checked-bg
is:
$component-active-bg: theme-color("primary") !default;
// ...
$custom-checkbox-indicator-indeterminate-bg: $component-active-bg !default;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With