Skip to content

overscroll-behavior

Utilities for controlling how the browser behaves when reaching the boundary of a scrolling area.

Quick reference

ClassStyles
overscroll-autooverscroll-behavior: auto;
overscroll-containoverscroll-behavior: contain;
overscroll-noneoverscroll-behavior: none;
overscroll-x-autooverscroll-behavior-x: auto;
overscroll-x-containoverscroll-behavior-x: contain;
overscroll-x-noneoverscroll-behavior-x: none;
overscroll-y-autooverscroll-behavior-y: auto;
overscroll-y-containoverscroll-behavior-y: contain;
overscroll-y-noneoverscroll-behavior-y: none;

Source: https://tailwindcss.com/guide/overscroll-behavior

Examples

Preventing parent overscrolling

html
<div class="h-48 overflow-auto overscroll-contain p-8 ...">
  <p>Well, let me tell you something, …</p>
  <p>Sure, go ahead, laugh if you want to. …</p>
  <p>Maybe we can live without libraries, …</p>
</div>

Preventing overscroll bouncing

html
<div class="h-48 overflow-auto overscroll-none p-8 ...">
  <p>Well, let me tell you something, …</p>
  <p>Sure, go ahead, laugh if you want to. …</p>
  <p>Maybe we can live without libraries, …</p>
</div>

Using the default overscroll behavior

html
<div class="h-48 overflow-auto overscroll-auto p-8 ...">
  <p>Well, let me tell you something, …</p>
  <p>Sure, go ahead, laugh if you want to. …</p>
  <p>Maybe we can live without libraries, …</p>
</div>

Responsive design

Prefix an overscroll-behavior utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

html
<div class="overscroll-auto md:overscroll-contain ...">Lorem ipsum dolor sit amet...</div>

Learn more about using variants in the variants documentation.

Released under the MIT License.