webkit css 滚动条样式
有没有办法完全摆脱滚动轨道?或者让它覆盖内容而不是把它推到一边?喜欢 iOS/Lion 滚动条吗?
下面的内容非常接近,但即使轨道是透明的,可滚动区域的内容也会被推过去,并且页面背景会显示出来。
::-webkit-scrollbar {
width:8px;
height:8px;
-webkit-border-radius: 4px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-track-piece {
background-color:transparent;
}
::-webkit-scrollbar-thumb {
background-color: rgba(053, 057, 071, 0.3);
width: 6px;
height: 6px;
-webkit-border-radius:4px;
}
Is there any way of getting rid of the scroll track entirely? Or making it overlay the content rather than pushing it aside? Like iOS/Lion scrollbars?
The following gets pretty close, but even though the track is transparent, the content of the scrollable region is pushed over and the page background shows through.
::-webkit-scrollbar {
width:8px;
height:8px;
-webkit-border-radius: 4px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-track-piece {
background-color:transparent;
}
::-webkit-scrollbar-thumb {
background-color: rgba(053, 057, 071, 0.3);
width: 6px;
height: 6px;
-webkit-border-radius:4px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,我想我之前回答过这个问题,也许没有:
div(溢出:滚动或溢出-y:滚动)。
现在您可以使用 rgba(0,0,0,0.3) 将轨道 css 设置为任何不透明度,因为滚动不是正文的一部分。
如果您想尝试,自定义 Firefox 滚动条的另一个技巧是:
它会给 Firefox 滚动带来一点颜色/纹理。 (为了可比性,强制滚动到右侧可能是理想的选择)
我还没有尝试过,但它是可行的
Hmm, I thought I answered this one previously, maybe not:
div (overflow:scroll or overflow-y:scroll).
Now you can set the track css to any opacity using rgba(0,0,0,0.3) because the scroll is not part of the body.
Another tip for customizing firefox scroll bar if you want to experiment is to:
It will give the firefox scroll a little color/ texture. (May be ideal to force the scroll to the right for comparability)
I've not tried it yet but it's do-able