I use custom scrollbars on my site, and I was wondering if it's possible to have the background image of the body
behind my scrollbar, as it works well with textarea
.
Edit: I want the scrollbar to be still usable with the cursor.
textarea {
background-repeat: repeat;
background-image: url(https://barrycap.com/assets/bg/home.svg);
width: 200px;
height: 150px;
resize: none;
scrollbar-color: #888f #fff0;
}
body {
background-color: #222;
background-repeat: repeat;
background-image: url(https://barrycap.com/assets/bg/random.svg);
width: 200px;
height: 150px;
resize: none;
scrollbar-color: #888f #0000;
}
<html>
<body>
<textarea>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</textarea>
<textarea>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</textarea>
</body>
</html>
I didn't saw it in the first place, but the scrollbar colors don't work on Chrome (I posted my question on Firefox). I've got another method for my site on Chrome.
Here is a screenshot of the snippet in Firefox:
Edit: The question has been answered for Chrome by @HereticMonkey.
But the transparent scrollbar track for the body
doesn't work in Firefox.
I changed the background color and background image of the body to make the issue an evidence.