如何使用css更改滚动条颜色 [英] How to change the scrollbar color using css

查看:368
本文介绍了如何使用css更改滚动条颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的jsfiddle在这里

我尝试更改

My jsfiddle is here
I trying to change the color of the scrollbar but here it is not working.

Css:

.flexcroll {     
    scrollbar-face-color: #367CD2;
    scrollbar-shadow-color: #FFFFFF;
    scrollbar-highlight-color: #FFFFFF;
    scrollbar-3dlight-color: #FFFFFF;
    scrollbar-darkshadow-color: #FFFFFF;
    scrollbar-track-color: #FFFFFF;
    scrollbar-arrow-color: #FFFFFF;
}​


推荐答案

webkit的属性,可以进入 shadow DOM

You can use the following attributes for webkit, which reach into the shadow DOM:

::-webkit-scrollbar              { /* 1 */ }
::-webkit-scrollbar-button       { /* 2 */ }
::-webkit-scrollbar-track        { /* 3 */ }
::-webkit-scrollbar-track-piece  { /* 4 */ }
::-webkit-scrollbar-thumb        { /* 5 */ }
::-webkit-scrollbar-corner       { /* 6 */ }
::-webkit-resizer                { /* 7 */ }

根据此页面的代码解释问题,工作小提琴与红色滚动条。

Here's a working fiddle with a red scrollbar, based on code from this page explaining the issues.

http://jsfiddle.net/hmartiro/Xck2A/1/

使用此和您的解决方案,您可以处理除Firefox以外的所有浏览器,此时我认为仍需要一个javascript解决方案。

Using this and your solution, you can handle all browsers except Firefox, which at this point I think still requires a javascript solution.

这篇关于如何使用css更改滚动条颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆