Categories
CSS

How to allow scroll but hide scrollbar with CSS?

Spread the love

Sometimes, we want to allow scroll but hide scrollbar with CSS.

In this article, we’ll look at how to allow scroll but hide scrollbar with CSS.

How to allow scroll but hide scrollbar with CSS?

To allow scroll but hide scrollbar with CSS, we select the ::-webkit-scrollbar pseudo-element.

For instance, we write

::-webkit-scrollbar {
  display: none;
}

to hide the scrollbar by selecting ::-webkit-scrollbar and set the display property to none.

Conclusion

To allow scroll but hide scrollbar with CSS, we select the ::-webkit-scrollbar pseudo-element.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *