Firefox 的自定义 CSS 滚动条 [英] Custom CSS Scrollbar for Firefox

查看:54
本文介绍了Firefox 的自定义 CSS 滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 CSS 自定义滚动条.

I want to customize a scrollbar with CSS.

我使用这个 WebKit CSS 代码,它适用于 Safari 和 Chrome:

I use this WebKit CSS code, which works well for Safari and Chrome:

::-webkit-scrollbar {
  width: 15px;
  height: 15px;
}

::-webkit-scrollbar-track-piece {
  background-color: #c2d2e4;
}

::-webkit-scrollbar-thumb:vertical {
  height: 30px;
  background-color: #0a4c95;
}

如何在 Firefox 中做同样的事情?

How can I do the same thing in Firefox?

我知道我可以使用 jQuery 轻松完成,但如果可行,我更愿意使用纯 CSS 来完成.

I know I can easily do it using jQuery, but I would prefer to do it with pure CSS if it's doable.

推荐答案

截至 2018 年底,Firefox 中现在提供有限的自定义!

As of late 2018, there is now limited customization available in Firefox!

查看这些答案:

这是背景信息:https://bugzilla.mozilla.org/show_bug.cgi?id=1460109

没有与 ::-webkit-scrollbar 和朋友等效的 Firefox.

There's no Firefox equivalent to ::-webkit-scrollbar and friends.

你必须坚持使用 JavaScript.

You'll have to stick with JavaScript.

很多人都喜欢这个功能,请参阅:https://bugzilla.mozilla.org/show_bug.cgi?id=77790

Plenty of people would like this feature, see: https://bugzilla.mozilla.org/show_bug.cgi?id=77790

就 JavaScript 替换而言,您可以尝试:

As far as JavaScript replacements go, you can try:

这篇关于Firefox 的自定义 CSS 滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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