'How to properly trim the edge of an input range track in CSS?
I am trying to build a slider component that looks similar to this:

But the slider thumb will not extend past the edge of the line for the desired effect.

So I add a little bit of extra width with width: calc(80% + 30px); where the 30px is the width of the thumb and gives me a half of a thumb-width of overhang to work with.

But when I try to clip the visible track to size with clip-path: polygon(15px -1000%, calc(100% - 15px) -1000%, calc(100% - 15px) 1000%, 15px 1000%);, it also clips the thumb.

Is there a way to clip the track properly without clipping the thumb?
This is my code (organized as a .svelte component).
<script>
export let name;
let value = 3;
</script>
<style>
input[type=range] {
appearance: none;
position: relative;
background-color: #b3b3b3;
width: calc(80% + 30px);
height: 2px;
padding: 0;
top: -22px;
clip-path: polygon(15px -1000%, calc(100% - 15px) -1000%, calc(100% - 15px) 1000%, 15px 1000%);
border: none;
}
input[type=range]::-webkit-slider-thumb {
appearance: none;
width: 30px;
height: 30px;
border-radius: 50%;
background: yellowgreen;
}
span {
margin-left: calc(10% - 8px);
margin-right: calc(10% - 8px);
float: left;
width: 16px;
height: 16px;
padding: 0;
background: #b3b3b3;
border-radius: 50%;
}
.tick-container {
height: 16px;
padding: 0;
justify-content: left;
}
</style>
<h2>{name}</h2>
<div class="tick-container">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<input on:input={slider => value = slider.target.value} type="range" min="1" max="5" value={value}>
Solution 1:[1]
I have created a mongo replicaset of 3 nodes(1 primary, 2 secondaries), with secutiry enabled (authentication required)
I am able to connect to mongo-replicaset with following spring configuration and able to read and write records to mongo-replicaset.
<mongo:mongo id="mongo" replica-set="localhost:27041,localhost:27042,localhost:27043"/>
<mongo:db-factory id="mongoDbFactory"
mongo-ref="mongo"
dbname="testdb"
username="testuser"
password="testuserpass12"/>
<mongo:template db-factory-ref="mongoDbFactory" id="mongoTemplate"/>
Spring-Data-Mongo version used is
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.10.11.RELEASE</version>
</dependency>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ParagFlume |
