Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make scrollbar always visible

Tags:

css

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.

I have next code

<div class="scrollbar">
   Scrollable content
</div>

and the css code is as follows:

/* 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:

enter image description here

But on Iphone safari I do not see it:

enter image description here

I see it when I start to scroll and it has default styling.

Any idea?

like image 759
Boky Avatar asked Oct 15 '25 23:10

Boky


1 Answers

Change width: 100% to width: 7px will work

::-webkit-scrollbar {
    background-color: #f5f5f5;
    border-radius: 10px;
    width: 7px;
    height: 2px;
}
::-webkit-scrollbar-thumb {
    background-color: #000000;
    border-radius: 10px;
}
like image 113
abcid d Avatar answered Oct 18 '25 16:10

abcid d



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!