kthornbloom
kthornbloom

Reputation: 3730

Webkit Scrollbars in one place, not another

I'm using webkit scrollbars in a scrollable div. That's working great. However, I'd like the actual page's scrollbars to be the OS default. How can I use CSS selectors to make the webkit scrollbars only apply to the div? An example: http://jsfiddle.net/zxj4m/

Upvotes: 1

Views: 3926

Answers (1)

sdleihssirhc
sdleihssirhc

Reputation: 42496

You apply the styles to the scrollbars like so:

::-webkit-scrollbar-thumb { ... }

Those are pseudo-selectors. To only apply them to a certain class, prepend the class name like so:

.box::-webkit-scrollbar-thumb { ... }

By leaving it blank, the browser assumes you're using the universal select (*), which applies to every single element on the page.

Upvotes: 6

Related Questions