css - 如何让 Scroll 在 Firefox 中可见

标签 css webkit

我有一个在 chrome 中可见的滚动条,但它不支持 firefox。任何建议。

<div class="item-list">
</div>

.item-list::-webkit-scrollbar {
  -webkit-appearance: none;
  -moz-appearance:none;
  width: 10px;
}

.item-list::-webkit-scrollbar-thumb {
  border-radius: 5px;
  height: 80px;
  background-color: rgba(0,0,0,.5);
  -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}

最佳答案

stackoverflow post似乎表明 Firefox 64 对样式滚动条的支持有限;它试图满足此处概述的已定义 W3C 标准 CSS Scrollbars Module Level 1 .

这“添加了 scrollbar-width 和 scrollbar-color 两个新属性,它们可以控制滚动条的显示方式。”

我试图在下面这个 fiddle 中给你一个例子,

body {
  overflow: hidden;
}

.item-list {
  width: 200px;
  height: 200px;
  background-color: red;
  overflow: scroll;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, .5) rgba(0, 0, 0, 0);
}

.content {
  height: 1000px;
}

.item-list::-webkit-scrollbar {
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 10px;
}

.item-list::-webkit-scrollbar-thumb {
  border-radius: 5px;
  height: 80px;
  background-color: rgba(0, 0, 0, .5);
  -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5);
}
<div class="item-list">
  <div class="content">
  </div>
</div>

关于css - 如何让 Scroll 在 Firefox 中可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55238747/

相关文章:

html - 这个标记有什么 "wrong"吗?

html - Bootstrap Glyphicons 隐藏边框

Safari webkit 构建/修订

css - Chrome 中的位置固定

css - 网站上的动画

css - 在 Polymer 1.0 中为 css 属性设置动画

html - 如何在 html 中显示绝对路径图像 [ yii2 ]

Android WebKit 聚焦文本区域不会绘制背景图像

html - webkit-transform 在 Safari 上破坏了 z-index

css - 如何为 :before on webkit browsers? 之类的伪元素设置动画