Css overflow:scroll does not work on mobile
Asked Answered
F

5

6

I have a website and I want to display comments in a div. I tried to use an overflow scroll div but it overflowed on mobile devices. It does work on my computer What am I doing wrong?

Freemon answered 28/2, 2020 at 4:31 Comment(3)
Scrolls for me in Mobile Safari. Maybe post some code.Scriptural
@Scriptural Strange cuz for me and my frirnds who use Android, it does not scroll.Freemon
developer.mozilla.org/en-US/docs/Web/CSS/… - Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.Norm
V
9

add this css code to your container with overflow scroll.

-webkit-overflow-scrolling: touch;

Verner answered 28/2, 2020 at 5:42 Comment(5)
this is more of a comment than an answerBlende
I can't add a comment yet until I reach 50 reputation.Verner
#rightbox form { width: 500px; overflow: scroll; -webkit-overflow-scrolling: touch; }Verner
-webkit-overflow-scrolling: touch is invalid property valueLorou
Works great in Chrome for Moto G5 Plus Android 8.1.0 (+1).Begot
P
1

How i solved that, i strugled a lot and finally i put in html css media query next code

@media screen and (max-width: 700px) {
  html {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    max-width: 100vw !important;
    overflow: hidden !important;
    overflow-y: auto !important;
  }
  html ::-webkit-scrollbar {
    display: none;
  }
}

Dont use -webkit-overflow-scrolling: touch; !

In yours case make similar media query for your div element and adjust values by yours requirements.

I hope will be helpfull.

Paltry answered 2/6, 2023 at 9:34 Comment(0)
B
0

You can try it!

overflow-y: scroll !important;
-webkit-overflow-scrolling: touch;
Bab answered 25/6, 2021 at 2:36 Comment(0)
F
0

overflow: scroll; // this property will work on mobile devices for scroll instead of ove

Frayda answered 17/9, 2021 at 20:11 Comment(0)
S
0

using -webkit-overflow-scrolling: touch; is the correct solution but it invalid in react, next you would need to use WebkitOverflowScrolling: "touch"

Storybook answered 10/6, 2022 at 19:26 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.