How to hide HTML horizontal but not vertical scrollbar with CSS?

Spread the love

Sometimes, we want to hide HTML horizontal but not vertical scrollbar with CSS.

In this article, we’ll look at how to hide HTML horizontal but not vertical scrollbar with CSS.

How to hide HTML horizontal but not vertical scrollbar with CSS?

To hide HTML horizontal but not vertical scrollbar with CSS, we set the overflow properties.

For instance, we write

body {
  overflow-y: scroll;
  overflow-x: hidden;
}

to hide the horizontal scrollbar with overflow-x: hidden;

And we always show the vertical scrollbar with overflow-y: scroll;.

Conclusion

To hide HTML horizontal but not vertical scrollbar with CSS, we set the overflow properties.

Leave a Reply

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