Categories
CSS

How to hide the scroll bar if not needed with CSS?

Spread the love

To hide the scroll bar if not needed with CSS, we set the overflow-y property.

For instance, we write

div {
  overflow-y: auto;
}

to only show the vertical scrollbar only when needed with overflow-y: auto;.

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 *