简体   繁体   中英

How to style HTML5 range input to have different color before and after slider in React?

I am using HTML5 to create a range slider in React, and want to have two different colors before and after slider, I tried with css but it didn't work see the demo I want to have something like this image

image

any help please?

I just want to clarify that this is solely a CSS fix. The link above certainly addresses how to conceptualize and then style the progress or range element.

For React, there are routes you could go based on the slider value as a percentage, even using styled-components . However, this fork is a simple copy-paste job from the resource I linked above last week. Styling is different, but you can tune it to your needs. I'd suggest looking up the rules and selectors to understand how they relate, what they specifically bear on, and how you can then tweak them to suit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM