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

  • How to limit the character count of the paragraph text

    October 8, 2022
    Instead of showing the whole text paragraph from the post entry, here is how you can limit the character count.…
  • CSS reset basic

    October 6, 2022
    Here is a stripped-down CSS reset code to start the front-end HTML layout. This is just for quick development; otherwise,…
  • BEM – CSS naming convention

    October 7, 2022
    The Block, Element, Modifier methodology (commonly referred to as BEM) is a popular naming convention for classes in HTML and…