Skip to content

Instantly share code, notes, and snippets.

@Subash Subash/style.css
Last active Apr 11, 2019

Embed
What would you like to do?
Disable Rubber-Band / Elastic Scroll in macOS with pure CSS
html {
height: 100%;
width: 100%;
overflow: hidden;
}
body {
height: 100%;
padding: 0;
overflow: auto;
margin: 0;
-webkit-overflow-scrolling: touch;
}
@frozeman

This comment has been minimized.

Copy link

commented Sep 3, 2015

The problem is, that this disallows position: fixed elements..

@PaulBGD

This comment has been minimized.

Copy link

commented Mar 14, 2016

Perfect, thanks!

@betsydupuis

This comment has been minimized.

Copy link

commented Aug 5, 2016

I set up a codepen demo of this if anyone is interested. http://codepen.io/itsjustluck/pen/xOyjqN

@Raminsiach

This comment has been minimized.

Copy link

commented Oct 10, 2016

doesnt work for me.

@gamecubate

This comment has been minimized.

Copy link

commented Feb 4, 2017

This doesn't work for me either. Tested on iOS 10.1.1 Safari.

@trajano

This comment has been minimized.

Copy link

commented Apr 29, 2017

@gamecubate this is for OSX not iOS Safari

@evanjmg

This comment has been minimized.

Copy link

commented Aug 29, 2017

doesn't work for OSX Chrome

@ghost

This comment has been minimized.

Copy link

commented Nov 19, 2017

Hey guys, just try:

html {
    overflow: hidden;
}

Tested on latest Safari, Chrome and Firefox

@edotassi

This comment has been minimized.

Copy link

commented Jan 17, 2018

@realwangyibo great!

@noahspoke

This comment has been minimized.

Copy link

commented Jan 23, 2018

@realwangyibo works correctly for me!

@hyperknot

This comment has been minimized.

Copy link

commented Apr 2, 2018

@realwangyibo thanks!

@redmanous

This comment has been minimized.

Copy link

commented Apr 19, 2018

omg thank you so much ! this worked for me perfectly

@henrylearn2rock

This comment has been minimized.

Copy link

commented Jul 9, 2018

doesn't work for me. ios 12 beta on iphone

@bfred-it

This comment has been minimized.

Copy link

commented Mar 19, 2019

If your site has a problem with inertial scrolling, then fix the problem, don't break the user's expectations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.