使用纯CSS的Div的自定义滚动条 [英] Custom Scroll Bar for Div with pure CSS
本文介绍了使用纯CSS的Div的自定义滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法自定义滚动条只有CSS,影响一个特定的div,而不是整个页面的一切?
Is there a way to customize a scrollbar with only CSS that effects a specific div and not everything in the entire page?
我发现我可以使用 :: - webkit-scrollbar
为了改变滚动条的样式,但这会影响页面上的每个滚动条。
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.
我正在寻找一种纯粹的CSS方式来定制页面上的特定滚动条。
I'm looking for a purely CSS way of styling a specific scroll bar on the page.
这可能吗?
推荐答案
当然是。所有你需要做的是记住 :: - webkit-scrollbar
是一个伪类,因此,可以这样使用:
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 { ... }
这篇关于使用纯CSS的Div的自定义滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文