[英]How to make scrollbar always visible
I want to make the scrollbar always visible.我想让滚动条始终可见。 The problem is that I see it in chrome and safari, but not on Iphone and in mozilla.问题是我在 chrome 和 safari 中看到它,但在 Iphone 和 mozilla 中看不到。
I have next code我有下一个代码
<div class="scrollbar">
Scrollable content
</div>
and the css code is as follows: css代码如下:
/* Scroll thumb styles */
.scrollbar::-webkit-scrollbar {
background-color: #f5f5f5;
border-radius: 10px;
width: 100%;
height: 2px;
}
.scrollbar::-webkit-scrollbar-thumb {
background-color: #000000;
border-radius: 10px;
}
On Android devices or in Chrome and Safari on desktop I see something as follows:在 Android 设备或 Chrome 和 Safari 在桌面上,我看到如下内容:
But on Iphone safari I do not see it:但是在 Iphone safari 上我看不到它:
I see it when I start to scroll and it has default styling.当我开始滚动时我看到它并且它具有默认样式。
Any idea?任何想法?
to make both scrollbars always visible use overflow: scroll, make only x-axis scrollbar visible use overflow-x and overflow-y for y-axis.要使两个滚动条始终可见,请使用溢出:滚动,仅使 x 轴滚动条可见,对 y 轴使用溢出-x 和溢出-y。 use overflow: auto when you want to display the scrollbar when there is content larger then the container使用 overflow: auto 当你想在内容大于容器时显示滚动条
Change width: 100% to width: 7px will work将 width: 100% 更改为 width: 7px 即可
::-webkit-scrollbar {
background-color: #f5f5f5;
border-radius: 10px;
width: 7px;
height: 2px;
}
::-webkit-scrollbar-thumb {
background-color: #000000;
border-radius: 10px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.