-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
  • 58,414
  • 16
  • 114
  • 157
doglover123
  • 103
  • 1
  • 1
  • 6

2 Answers2

1

Try this

.class::scrollbar

Can also use the prefixes.

.class::-webkit-scrollbar
Dominofoe
  • 603
  • 7
  • 18
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
  • 37,875
  • 18
  • 96
  • 111