CSS firefox - 自定义滚动条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20537104/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 01:16:55  来源:igfitidea点击:

firefox - customize scroll bar

css

提问by Sajeeb

i have the following code that customizes a webkit scroll bar....

我有以下代码可以自定义 webkit 滚动条....

/*webkit scroll bar*/  

::-webkit-scrollbar {
    width: 6px;
}


::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
    -webkit-border-radius: 10px;
    border-radius: 10px;
}


::-webkit-scrollbar-thumb {
    -webkit-border-radius: 10px;
    border-radius: 10px;
    background: rgba(255,0,0); 
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
}
::-webkit-scrollbar-thumb:window-inactive {
    background: rgba(255,0,0); 
}

what i would like to do is customize the scrollbar of a page loaded in firefox the same way... for which i tried the following code..

我想做的是以相同的方式自定义在 Firefox 中加载的页面的滚动条......为此我尝试了以下代码..

/*mozilla scroll bar*/  

::-moz-scrollbar {
    width: 6px;
}


::-moz-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
    -webkit-border-radius: 10px;
    border-radius: 10px;
}


::-moz-scrollbar-thumb {
    -webkit-border-radius: 10px;
    border-radius: 10px;
    background: rgba(255,0,0); 
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
}
::-moz-scrollbar-thumb:window-inactive {
    background: rgba(255,0,0); 
}

but it does not work..... how can i customize the scrollbar in the same way i did for webkit... any help would be appreciated... thanks in advance... :)

但它不起作用..... 我如何以与 webkit 相同的方式自定义滚动条...任何帮助将不胜感激...提前致谢... :)

回答by MineCMD

You can't because of bug #77790(Link#1).

你不能因为错误 #77790(Link#1)。

Bug 77790 - (scrollbar-colors) Style the scrollbar (binding ::-moz-horizontal-scrollbar to XBL)\

错误 77790 - (scrollbar-colors) 设置滚动条样式(将 ::-moz-horizo​​ntal-scrollbar 绑定到 XBL)\

The only way is to use jQuery. I don't know how to code it, so don't ask me. I prepared the following links for jQuery scrollbars. Click here!(Link#2)

唯一的方法是使用jQuery。我不知道如何编码,所以不要问我。我为 jQuery 滚动条准备了以下链接。点击这里!(链接#2)

Links:

链接:

回答by Paresh Rajput

FireFox support these two:

FireFox 支持这两个:

  1. scrollbar-width : auto|thin|none...
  2. scrollbar-color
  1. 滚动条宽度:自动|细|无...
  2. 滚动条颜色