I have implemented the bootstrap 5 range component, but I am encountering some issues
- Why is the dot not displaying in the center of the line even though I added the min value of 1?
- Is there a way to display the value of the range in the input field?
- How can I change the background color or apply a linear gradient to the line?
.customRange {
-webkit-appearance: none;
width: 100%;
height: 25px;
background: transparent;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}
.customRange:hover {
opacity: 1;
}
.customRange::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #04AA6D;
cursor: pointer;
}
.customRange::-moz-range-thumb {
width: 25px;
height: 25px;
background: #04AA6D;
cursor: pointer;
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="10727f7f64636462716050253e203e203d7275647123">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet">
<div class="w-50 mx-auto">
<div class="d-flex justify-content-between"><label>Range</label>
<div><input type="text" name="" value="">%</div>
</div>
<input type="range" class="form-range customRange" min="1" max="100" oninput="this.nextElementSibling.value = this.value">
<div class="d-flex justify-content-between">
<span>1</span>
<span>100</span>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>