How to change the scrollbar color of the browser window

我们两清 提交于 2019-12-25 07:29:12

问题


I want to change the color of the scroll bar of browser window, I used the following code but its working only in IE8 and not in other like Chrome and Mozilla..

html {scrollbar-face-color:#D6D7D6 ;
scrollbar-shadow-color: #FFFFFF;
scrollbar-highlight-color:#EFEFEF;
scrollbar-3dlight-color: #FFFFFF;

scrollbar-track-color: #FFFFFF;
scrollbar-arrow-color:  #000000;}

回答1:


Have you considered using a jQuery plugin? Such as jScrollPane or Tiny Scrollbar.

As this question states:

Scrollbar CSS styles are an oddity invented by Microsoft developers. They are not part of the W3C standard for CSS and therefore most browsers just ignore them.

I'd recommend those jQuery plugins, as they are compatible with all browsers.

If you would rather not to use a plugin, it seems that as of 2013, 70% of browsers support some scrollbar styling. Such as this example code for webkit browsers: (ie Chrome)

#doc ::-webkit-scrollbar{width:9px;height:9px;}
#doc ::-webkit-scrollbar-button:start:decrement,#doc ::-webkit-scrollbar-button:end:increment{display:block;height:0;background-color:transparent;}
#doc ::-webkit-scrollbar-track-piece{background-color:#FAFAFA;-webkit-border-radius:0;-webkit-border-bottom-right-radius:8px;-webkit-border-bottom-left-radius:8px;}
#doc ::-webkit-scrollbar-thumb:vertical{height:50px;background-color:#999;-webkit-border-radius:8px;}
#doc ::-webkit-scrollbar-thumb:horizontal{width:50px;background-color:#999;-webkit-border-radius:8px;}

Each browser needs a different syntax, I would still suggest using a plugin.



来源:https://stackoverflow.com/questions/15898447/how-to-change-the-scrollbar-color-of-the-browser-window

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