JSFiddle - React, Tailwind, and code Playground
HTML
<div id='wrapper'>
<div id='splitter' style='left: 50%'></div>
</div>
<input id='slider' type='range' min='0' max='100' value='50'/>
CSS
body, html{
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background: #222;
}
input{
margin-top: 10px;
}
#wrapper{
width: 500px;
height: 50px;
background: #444;
position: relative;
display: flex;
}
/*left*/
#wrapper::before{
content:'';
width: 50px;
height: 50px;
background: linear-gradient(0deg,#00be1abf,#5fed00b3);
position: absolute;
left: 0px;
}
/*right*/
#wrapper::after{
content:'';
width: 50px;
height: 50px;
background: linear-gradient(0deg,#9f0000ff,#f10000ff);
position: absolute;
right: 0px;
}
#splitter{
position: relative;
transform: translateX(-50%);
background: #ddd;
height: 50px;
width: 10px;
z-index: 99;
}
JavaScript
document.getElementById("slider").addEventListener("change", function(){
document.getElementById("splitter").style.left = this.value + "%";
})