Html – Disable Scrolling on Body


I would like to disable scrolling on the HTML body completely. I have tried the following options:

  • overflow: hidden; (not working, did not disable scrolling, it just hid the scrollbar)

  • position: fixed; (this worked, but it scrolled completely to the top, which is unacceptable for this specific application)

I was unable to find any alternatives to these two options, are there any more?

Best Answer

Set height and overflow:

html, body {margin: 0; height: 100%; overflow: hidden}

Related Question