-1

I want to add specific styling for divs having a scrollbar, is there a way to select all divs that have a scrollbar? Can I use pseudo-element-selector for that?

For example?

div.has-scrollbar {background-color:red; }
div.no-scrollbar {background-color:green; }

To be clear, I don't want to style the scrollbar itself.

I tried something like this:

div:not(::-webkit-scrollbar)
Thomas Verhoeven
  • 238
  • 3
  • 16
  • Maybe these help? https://stackoverflow.com/questions/4814398/how-can-i-check-if-a-scrollbar-is-visible https://stackoverflow.com/questions/4880381/check-whether-html-element-has-scrollbars – NHerwich Sep 22 '21 at 08:34
  • @NHerwich that would be an option, but trying to do it completly in css – Thomas Verhoeven Sep 23 '21 at 09:02
  • Oh, I don't think that's possible. But I wish it would be, because I am having the same issue you are having. – NHerwich Sep 23 '21 at 10:15

1 Answers1

0

Try this :

body {
scrollbar-base-color: #000000;
scrollbar-face-color: #000000;
scrollbar-shadow-color: #FFFFFF;
scrollbar-arrow-color: #FFFFFF;
scrollbar-highlight-color: #FFFFFF;
scrollbar-dark-shadow-color: #FFFFFF;
scrollbar-3d-light-color: #FFFFFF;
scrollbar-track-color: #FFFFFF;}

I hope it was helpful

Jacopo99
  • 75
  • 1
  • 7