Home >Web Front-end >CSS Tutorial >How Can I Style HTML5 Range Inputs with Different Colors on Each Side?
Styling HTML5 Range Inputs with Different Colors on Each Side
Achieving varying colors before and after the slider of an HTML5 range input requires browser-specific approaches.
Chrome:
IE:
Firefox:
Example Code:
@media screen and (-webkit-min-device-pixel-ratio:0) { input[type='range'] { overflow: hidden; width: 80px; background-color: #9a905d; } input[type='range']::-webkit-slider-runnable-track { height: 10px; color: #13bba4; margin-top: -1px; } input[type='range']::-webkit-slider-thumb { width: 10px; height: 10px; cursor: ew-resize; background: #434343; box-shadow: -80px 0 0 80px #43e5f7; } } input[type="range"]::-moz-range-progress { background-color: #43e5f7; } input[type="range"]::-moz-range-track { background-color: #9a905d; } input[type="range"]::-ms-fill-lower { background-color: #43e5f7; } input[type="range"]::-ms-fill-upper { background-color: #9a905d; }
<input type="range" />
The above is the detailed content of How Can I Style HTML5 Range Inputs with Different Colors on Each Side?. For more information, please follow other related articles on the PHP Chinese website!