OMGodCoder
OMGodCoder

Reputation: 25

How to disable page scroll in html/css/js?

I am using html/css/js to make a website but a scroll is appering because of some effects I added. But I don't want a user to see the scrollbar or even scroll with middle mouse button. What can I do to solve this problem?

Upvotes: 1

Views: 112

Answers (3)

user15644345
user15644345

Reputation:

you can use in CSS

overflow:hidden

https://developer.mozilla.org/de/docs/Web/CSS/overflow

or if you want to have scrolling but you can hide it

/* Hide scrollbar for Chrome, Safari and Opera */
.example::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.example {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_hide_scrollbar_keep_func

Upvotes: 0

Bizoon
Bizoon

Reputation: 51

Guesswork solution:

body {   overflow: hidden;  }

https://developer.mozilla.org/de/docs/Web/CSS/overflow

Upvotes: 1

henok tesfu
henok tesfu

Reputation: 71

you can use css for this problem if you don't want the scroll to appear

overflow: hidden; 

for more you can refer this overflow

Upvotes: 0

Related Questions