@ledminh
Posted
Making the checkboxes green is simple. I used the pseudo-class ::before
, set the position to absolute
with left and top equal 0, height and width equal 100%, then set its background-color
to green. To make the check-symbol image displayed when checked, I used the pseudo-class ::after
in the similar way but set its background
to be the check-symbol image when checked.
Making the slider half-green-half-black is more difficult. After spending a day doing research on Stack Overflow, I figured the easiest solution is to use linear-gradient on background to make it 50% green and 50% black initially, then using javascript to change the percentage value when the input's value changes.
Marked as helpful