brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: overscroll-behavior: contain stops css scroll chaining out of a modal or panel

Css
~/tips/tip-css-overscroll-behavior-contain-modal

.modal-body { overflow: auto; overscroll-behavior: contain; }

Keeps scrolling inside a panel when it reaches its end instead of moving the page behind it.

Scrolling to the end of a menu and then moving the page behind it is a small but constant annoyance.

.modal-body { overflow: auto; overscroll-behavior: contain; }

When an inner scroll area reaches its end, the leftover scroll movement normally passes on to the page underneath. overscroll-behavior: contain keeps it inside the element. The value none goes a step further and also disables effects such as pull to refresh and the bounce on iOS. It only has an effect on elements that can actually scroll, so the box needs a height limit and overflow set to auto or scroll. Safari supports it from version 16.

Further reading: MDN: overscroll-behavior

More Css tips CSS Overview in Chrome DevTools audits the colors and fonts of a page .notice:empty { .toast { article { counter-reset: h2; } .toolbar { All Css tips (66) All topics

Link