Interactivity

scrollbar-gutter

Utilities for controlling the gutter space reserved for an element's scrollbar.

ClassStyles
scrollbar-gutter-auto
scrollbar-gutter: auto;
scrollbar-gutter-stable
scrollbar-gutter: stable;
scrollbar-gutter-both
scrollbar-gutter: stable both-edges;

Examples

Reserving space for the scrollbar

Use the scrollbar-gutter-stable utility to reserve space for the scrollbar even when an element isn't overflowing:

scrollbar-gutter-auto

Hey everyone! It’s almost 2027 and we still don’t know if there are aliens living among us, or do we? Maybe the person writing this is an alien. You will never know.

scrollbar-gutter-stable

Hey everyone! It’s almost 2027 and we still don’t know if there are aliens living among us, or do we? Maybe the person writing this is an alien. You will never know.

<div class="scrollbar-gutter-stable overflow-auto ...">  <!-- ... --></div>

Reserving space on both sides

Use the scrollbar-gutter-both utility to reserve matching gutter space on both sides of the element:

<div class="scrollbar-gutter-both overflow-auto ...">  <!-- ... --></div>

Using the default gutter

Use the scrollbar-gutter-auto utility to only reserve gutter space when the browser would normally show a scrollbar:

<div class="scrollbar-gutter-auto overflow-auto ...">  <!-- ... --></div>

Responsive design

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

<div class="scrollbar-gutter-auto md:scrollbar-gutter-stable ...">  <!-- ... --></div>

Learn more about using variants in the variants documentation.

Copyright © 2026 Tailwind Labs Inc.·Trademark Policy

Tailwind CSS 中文网(本网站)的目标是为中文开发者提供准确、及时的 Tailwind CSS 中文文档

Tailwind CSS 中文文档由本网站维护人员共同翻译,采用 MIT 开源协议发布

本网站与 tailwindcss.com 及 Tailwind Labs Inc. 并无从属关系

Tailwind 商标由 Tailwind Labs Inc. 所有

京ICP备15031610号-106