Javascript 溢出-y:在 Chrome 中滚动不显示滚动条
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35201566/
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
Overflow-y: Scroll not showing scrollbar in Chrome
提问by Graham Cairns
I am generating a list of organisations of the left hand side of this page: http://www.ihhub.org/member-map/
我正在生成此页面左侧的组织列表:http: //www.ihhub.org/member-map/
This list is generated through appending <span>
tags that are linked to the corresponding map.
该列表是通过附加<span>
链接到相应地图的标签生成的。
My issue is - the scroll bar does not appear in CHROME but does appear in Firefox and Safari.
我的问题是 - 滚动条没有出现在 CHROME 中,但出现在 Firefox 和 Safari 中。
Any solutions?
任何解决方案?
UPDATE:
更新:
This issue appears to be isolated to MAC OS.
此问题似乎与 MAC OS 无关。
SOLUTION:
解决方案:
::-webkit-scrollbar {
-webkit-appearance: none;
width: 7px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0,0,0,.5);
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
回答by Graham Cairns
According to CSS - Overflow: Scroll; - Always show vertical scroll bar?: OSx Lion hides scrollbars while not in use to make it seem more "slick", but at the same time the issue you addressed comes up: people sometimes cannot see whether a div has a scroll feature or not.
根据CSS - 溢出:滚动;- 总是显示垂直滚动条?:OSx Lion 在不使用时隐藏滚动条以使其看起来更“光滑”,但同时您解决的问题出现了:人们有时无法看到 div 是否具有滚动功能。
CSS fix:
CSS修复:
::-webkit-scrollbar {
-webkit-appearance: none;
width: 7px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0,0,0,.5);
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
回答by Timo
回答by Timo
Add this to your css
将此添加到您的 css
.list::-webkit-scrollbar {
-webkit-appearance: scrollbartrack-vertical;
}
or
或者
.list::-webkit-scrollbar {
-webkit-appearance: scrollbarthumb-vertical;
}