How to prevent “overscrolling” of a web page with CSS?

Spread the love

Sometimes, we want to prevent "overscrolling" of a web page with CSS.

In this article, we’ll look at how to prevent "overscrolling" of a web page with CSS.

How to prevent "overscrolling" of a web page with CSS?

To prevent "overscrolling" of a web page with CSS, we hjide all overflow in the html element.

For instance, we write

html {
  overflow: hidden;
  height: 100%;
}

body {
  height: 100%;
  overflow: auto;
}

to hide overflow in the html element with overflow: hidden;.

And we allow overflow in the body element with overflow: auto; to let users scroll through overflowing content.

Conclusion

To prevent "overscrolling" of a web page with CSS, we hjide all overflow in the html element.

Leave a Reply

Your email address will not be published. Required fields are marked *