我有一个在chrome中可见的滚动条,但它不支持Firefox。任何建议。
i,ii,iii,iv,v,vi,vi,vii,x,xiv,xv,xix,1, 2, 3,5,58,88,99,101,125,201,601
答案 0 :(得分:0)
编辑CSS,您必须添加-moz-appearance行。 您可以在下面的链接中找到详细信息;
样品
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Scrollbars
详细信息
https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-scrollbar
.item-list {
scrollbar-color: rgba(255,255,255,.5);
scrollbar-width: thin;
}
.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);
}
如果要始终显示滚动条,则必须使用最小高度 css
.insider {min-height:250px; }
.item-list { width: 200px; height: 200px; overflow-y: scroll; scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .5) rgba(0, 0, 0, 0); }
.item-list {
scrollbar-color: rgba(255,255,255,.5);
scrollbar-width: thin;
}
.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="insider">
</div>
</div>
答案 1 :(得分:0)
此似乎表明Firefox 64对样式滚动条的支持有限。试图符合此处stackoverflow post概述的定义的W3C标准。
“这增加了滚动条宽度和滚动条颜色的两个新属性,可以控制滚动条的显示方式。”
我试图在下面的小提琴中给您一个例子,
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>