Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Hiding the scroll bar on an HTML page

Can CSS be used to hide the scroll bar? How would you do this?
by

2 Answers

aashaykumar
Here's my solution, which theoretically covers all modern browsers:

html {
scrollbar-width: none; / For Firefox */
-ms-overflow-style: none; /* For Internet Explorer and Edge */
}

html::-webkit-scrollbar {
width: 0px; /* For Chrome, Safari, and Opera
/
}
pankajshivnani123
Set overflow: hidden; on the body tag like this:

<style type="text/css">
body {
overflow: hidden;
}
</style>

The code above hides both the horizontal and vertical scrollbar.

If you want to hide only the vertical scrollbar, use overflow-y:

<style type="text/css">
body {
overflow-y: hidden;
}
</style>

And if you want to hide only the horizontal scrollbar, use overflow-x:

<style type="text/css">
body {
overflow-x: hidden;
}
</style>

Login / Signup to Answer the Question.