Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
styling rc-slider track to contain handles within itself

By default, the handles in React rc-slider are translated by -50% and their style is that the handle overlaps the rail, enter image description here but I need the handles to be contained within the rail, after expanding the rail and shrinking the handles the style presents as below
enter image description here as you can see, the handles are outside the track and I need them to be contained within, I have tried to translate them by zero or by 0 for the left one and 100% for the right one, but this would cause them to overlap one another like soenter image description here if not that they overlap, this would be the behavior I am after enter image description here here are my styles

.rc-slider {
    position: relative;
    height: 16px;
    padding: 5px 0;
    width: 100%;
    border-radius: 6px;
    touch-action: none;
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    background-color: transparent;
    display: flex;
    align-items: center;
}
.rc-slider * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.rc-slider-rail {
    position: absolute;
    width: 100%;
    background-color: #f9f8f8;
    height: 100%;
    border-radius: 6px;

}
.rc-slider-track {
    position: absolute;
    height: 100%;
    border-radius: 6px;
    background-color: #CDEA9F;
    opacity: 70%;
}
.rc-slider-handle {
    position: absolute;
    width: 24px;
    height: 12px;
    cursor: pointer;
    cursor: -webkit-grab;
    cursor: grab;
    border-radius: 40%;
    background-color: #8ECC29;
    touch-action: pan-x;
}

.rc-slider-handle-1 {
    transform: translateX(0) !important; <- this is wrong as can overlap

}
.rc-slider-handle-2 {
    transform: translateX(-100%) !important;<- this is wrong as can overlap

}

because the width is set dynamically I can not scale it or anything. I ran out of ideas so please help :)

Thanks a lot

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda