On my page, I'm displaying a log file in a div element with overflow-y:auto
. In the top right corner of the div, I'm overlaying a close button div with position:relative
.
When the scrollbar appears, the button is overlaying the scrollbar which is hard to see and looks ugly. You can see an example here: https://jsfiddle.net/4azw0rLf/
Moving it with javascript when scrollHeight
exceeds clientHeight
feels like a hack. Is there an option in CSS to move the close button to the left for the width of the scrollbar as soon as it appears?