Body set to overflow-y:hidden but page is still scrollable in Chrome

Cécile Boucheron picture Cécile Boucheron · Oct 8, 2013 · Viewed 102.3k times · Source

I'm having an issue with the overflow-y property in Chrome. Even though I've set it to hidden, I can still scroll the page with the mouse wheel.

Here is my code:

Does anybody know how to block the vertical scrolling in Chrome?

Thanks!

Answer

RhinoWalrus picture RhinoWalrus · Oct 8, 2013

Setting a height on your body and html of 100% should fix you up. Without a defined height your content is not overflowing, so you will not get the desired behavior.

html, body {
  overflow-y:hidden;
  height:100%;
}