How to prevent body scrolling but allow overlay scrolling with CSS?

Spread the love

To prevent body scrolling but allow overlay scrolling with CSS, we set the overscroll-behavior property.

For instance, we write

.overlay {
  overscroll-behavior: contain;
}

to add overscroll-behavior: contain; to prevent body scrolling but allow overlay scrolling with CSS.

Leave a Reply

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