JSFiddle - React, Tailwind, and code Playground
HTML
<div id="slyFrame_parent">
a
</div>
<div id="slyScrollbar_parent">
b
</div>
<div id="slyScrollbar_child">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore era
</div>
<div id="slyFrame_child">
d
</div>
CSS
* {
margin:0;
padding:0;
}
div {
height: 500px;
float: left;
}
#slyFrame_parent {
width: 60px;
background-color: #bbb;
}
#slyScrollbar_parent {
width: 16px;
background-color: #ccc;
}
#slyScrollbar_child {
background-color: #ddd;
width: 20px;
}
#slyFrame_child {
width: 16px;
background-color: #eee;
}
JavaScript
function setWidth() {
var a = 60,
b = 16,
c = document.getElementById('slyScrollbar_child'),
d = 16,
widthOfDivs = a + b + d,
dW = window.innerWidth;
c.style.width = dW - widthOfDivs + 'px';
}
setWidth();
window.onresize = setWidth;