javascript 如何将滚动条更改为自定义设计?(避免使用默认浏览器外观)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8562851/
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
How to change the scrollbar to custom design? (avoid using the default browser look)
提问by
In Gmail, the new look, you can see there is a scroll-bar but it does not look same like browser scrollbar. How to make it?
在新外观的 Gmail 中,您可以看到有一个滚动条,但它看起来不像浏览器滚动条。如何制作?
采纳答案by Su'
What you're seeing is WebKit-specific restylingof the browser's scrollbars. It doesn't apply to browsers based on other rendering engines. IE uses an entirely different set of style rules(there's a link in that post), and Firefox doesn't allow it at all normally, I believe. Mozilla, and the W3, consider the main browser scrollbars part of the OS GUI and so not something you should be messing with. You can get around these inconsistencies with scroller replacements like in Adam's suggestion, but the main scrollbars you're stuck with.
您看到的是浏览器滚动条的特定于WebKit 的重新设计。它不适用于基于其他渲染引擎的浏览器。IE 使用一套完全不同的样式规则(那篇文章中有一个链接),我相信 Firefox 通常根本不允许这样做。Mozilla 和 W3 将主浏览器滚动条视为 OS GUI 的一部分,因此您不应该弄乱它。您可以使用 Adam 的建议中的滚动条替换来解决这些不一致的问题,但主要的滚动条却被卡住了。