简体   繁体   English

如何更改div部分滚动条的CSS样式?

[英]How to change CSS style of scrollbars of a div section?

I have created a div section with a fixed width, while the content in it is overflowing, thus displaying a default horizontal scrollbar for that div. 我创建了一个固定宽度的div部分,而其中的内容溢出,因此显示该div的默认水平滚动条。 Now I want to style that horizontal scrollbar similar to this example : http://themefuse.com/demo/html/WebStudio/Dark/Green/index.html but without using jquery, code must be using only CSS and Javascript. 现在我想设置类似于这个例子的水平滚动条: http//themefuse.com/demo/html/WebStudio/Dark/Green/index.html但不使用jquery,代码必须只使用CSS和Javascript。

How can I achieve this? 我怎样才能做到这一点? Any help would be highly appreciated. 任何帮助将受到高度赞赏。

You have to use ::-webkit-scrollbar css rule that is compatible only with webkit-based browsers. 您必须使用:: - webkit-scrollbar css规则,该规则仅与基于webkit的浏览器兼容。 Here you can find a good howto/guide http://css-tricks.com/custom-scrollbars-in-webkit/ 在这里你可以找到一个很好的指南/指南http://css-tricks.com/custom-scrollbars-in-webkit/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM