-2

I know how to change the style of scrollbars for an entire page using CSS such as webkit-scrollbar codes.

However, how I only want to target the scroll bar in a div (not the browser's div). How can I accomplish this without using JavaScript or jQuery?

Thank you for your time.

isherwood
  • 52,576
  • 15
  • 105
  • 143
doglover123
  • 63
  • 1
  • 1
  • 6

2 Answers2

1

Try this

.class::scrollbar

Can also use the prefixes.

.class::-webkit-scrollbar
Dominofoe
  • 593
  • 6
  • 17
0

If I understand correctly, just use overflow:hidden; or overflow-y:hidden; on the desired div

div{box-sizing:border-box;}
#red{padding:5px;width:100%;height:1500px;background:red;}
#green{width:60%;height:900px;background:palegreen;overflow-y:hidden;}
<div id="red">
  <div id="green">
  </div>
</div>
cssyphus
  • 34,778
  • 18
  • 87
  • 102