Custom Scroll Bar for Div with pure CSS [duplicate]

≯℡__Kan透↙ 提交于 2019-12-12 18:22:20

问题


Is there a way to customize a scrollbar with only CSS that effects a specific div and not everything in the entire page?

I have found that I can use ::-webkit-scrollbar In order to change the style of a scrollbar, but this affects every scrollbar on the page.

I'm looking for a purely CSS way of styling a specific scroll bar on the page.

Is this possible?


回答1:


It certainly is. All you have to do is keep in mind that ::-webkit-scrollbar is a pseudo-class, and as such, can be used like this:

div.foo::-webkit-scrollbar { ... }


来源:https://stackoverflow.com/questions/9338818/custom-scroll-bar-for-div-with-pure-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!