user11709129
user11709129

Reputation:

-webkit-scrollbar for X axis only

I know that this:

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

can hide the scrollbar of an element, but it hides both the x and the y axis. I would like to hide only the x axis scrollbar and keep the y. Is there a standard way to do this? I'm looking for something like:

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

Thanks!

Edit: overflow-x: hidden will not work.

Upvotes: 0

Views: 2539

Answers (2)

user12929063
user12929063

Reputation:

As others have suggested use overflow-x: hidden; to hide the x-axis scroll bar. If you only include overflow-x: hidden; then this will only hide your x-axis scrollbar and not the y-axis one. If you want to hide both of them, then you would also have to include overflow-y: hidden;

Hope this explains.

Upvotes: 1

EdwardLi
EdwardLi

Reputation: 184

Sure. The standard for displaying both scrollbars is:

overflow: scroll;

but, if you only want vertical scrolling you can use:

overflow-y: scroll;

for more details you could see:

w3Schools - CSS overflow-y Property

Upvotes: 1

Related Questions