Instantly share code, notes, and snippets.

@Subash /style.css
Last active Nov 13, 2018

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.

frozeman commented Sep 3, 2015

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

@PaulBGD

This comment has been minimized.

PaulBGD commented Mar 14, 2016

Perfect, thanks!

@betsydupuis

This comment has been minimized.

betsydupuis 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.

Raminsiach commented Oct 10, 2016

doesnt work for me.

@gamecubate

This comment has been minimized.

gamecubate commented Feb 4, 2017

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

@trajano

This comment has been minimized.

trajano commented Apr 29, 2017

@gamecubate this is for OSX not iOS Safari

@evanjmg

This comment has been minimized.

evanjmg commented Aug 29, 2017

doesn't work for OSX Chrome

@ghost

This comment has been minimized.

ghost commented Nov 19, 2017

Hey guys, just try:

html {
    overflow: hidden;
}

Tested on latest Safari, Chrome and Firefox

@edotassi

This comment has been minimized.

edotassi commented Jan 17, 2018

@realwangyibo great!

@noahspoke

This comment has been minimized.

noahspoke commented Jan 23, 2018

@realwangyibo works correctly for me!

@hyperknot

This comment has been minimized.

hyperknot commented Apr 2, 2018

@realwangyibo thanks!

@redmanous

This comment has been minimized.

redmanous commented Apr 19, 2018

omg thank you so much ! this worked for me perfectly

@henrylearn2rock

This comment has been minimized.

henrylearn2rock commented Jul 9, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment