繁体   English   中英

如何在Firefox中使Scroll可见

[英]how to make Scroll visible in firefox

我有一个在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);
}

编辑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);
}

如果你想显示滚动条,你必须使用min-height 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> 

这篇stackoverflow帖子似乎表明Firefox 64对样式滚动条的支持有限。 试图满足此处概述的CSS滚动条模块级别1定义的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> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM