Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow html/body auto #83

Open
mhulse opened this issue Jul 18, 2016 · 0 comments
Open

Overflow html/body auto #83

mhulse opened this issue Jul 18, 2016 · 0 comments

Comments

@mhulse
Copy link
Owner

mhulse commented Jul 18, 2016

This makes the scroll bar appear when needed:

html,
body {
    overflow-x: hidden;
}
html {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

This always makes the scrollbar appear if you don’t want the page to jump when overflow occurs:

html,
body {
    overflow-x: hidden;
}
html {
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
}

I find that the above is useful for responsive sites when content may overflow the main container and cause horizontal scroll and/or layout issues. Using the above ensures that the overflow of said rogue element doesn’t cause too much layout chaos.

Important: Add -webkit-overflow-scrolling: touch; to html if you want iOS to scroll without being choppy.

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

No branches or pull requests

1 participant