How to Hide the Scrollbar with CSS

Here is a CSS code snippet to allow scroll but hide the scrollbar in your browser.

/* hide scrollbar but allow scrolling */
element {
    -ms-overflow-style: none; /* for Internet Explorer, Edge */
    scrollbar-width: none; /* for Firefox */
    overflow-y: scroll; 
}
element::-webkit-scrollbar {
    display: none; /* for Chrome, Safari, and Opera */
}

Laptop screen showing a photo gallery webpage

Leave the first comment

Related posts