1. Layout
  2. overflow

Layout

overflow

Utilities for controlling how an element handles content that is too large for the container.

ClassStyles
overflow-auto
overflow: auto;
overflow-hidden
overflow: hidden;
overflow-clip
overflow: clip;
overflow-visible
overflow: visible;
overflow-scroll
overflow: scroll;
overflow-x-auto
overflow-x: auto;
overflow-y-auto
overflow-y: auto;
overflow-x-hidden
overflow-x: hidden;
overflow-y-hidden
overflow-y: hidden;
overflow-x-clip
overflow-x: clip;
overflow-y-clip
overflow-y: clip;
overflow-x-visible
overflow-x: visible;
overflow-y-visible
overflow-y: visible;
overflow-x-scroll
overflow-x: scroll;
overflow-y-scroll
overflow-y: scroll;
overflow-ellipsis
text-overflow: ellipsis;

Examples

Showing content that overflows

Use the overflow-visible utility to prevent content within an element from being clipped:

Andrew Alfred Technical advisor
<div class="overflow-visible ..."></div>

Hiding content that overflows

Use the overflow-hidden utility to clip any content within an element that overflows the bounds of that element:

Andrew Alfred Technical advisor
<div class="overflow-hidden ..."></div>

Scrolling if needed

Use the overflow-auto utility to add scrollbars to an element in the event that its content overflows the bounds of that element:

Andrew Alfred Technical advisor
Debra Houston Analyst
Jane White Director, Marketing
Ray Flint Technical Advisor
<div class="overflow-auto ..."></div>

Scrolling horizontally if needed

Use the overflow-x-auto utility to allow horizontal scrolling if needed:

Andrew
Emily
Whitney
David
Kristin
Sarah
<div class="overflow-x-auto ..."></div>

Scrolling vertically if needed

Use the overflow-y-auto utility to allow vertical scrolling if needed:

Andrew Alfred Technical advisor
Debra Houston Analyst
Jane White Director, Marketing
Ray Flint Technical Advisor
<div class="h-32 overflow-y-auto ..."></div>

Scrolling horizontally always

Use the overflow-x-scroll utility to allow horizontal scrolling and always show scrollbars unless always-visible scrollbars are disabled by the operating system:

Sun
Mon
Tue
Wed
Thu
Fri
Sat
5 AM
6 AM
7 AM
8 AM
9 AM
10 AM
11 AM
12 PM
1 PM
2 PM
3 PM
4 PM
5 PM
6 PM
7 PM
8 PM
5 AM Flight to Vancouver Toronto YYZ
6 AM Breakfast Mel's Diner
5 PM πŸŽ‰ Party party πŸŽ‰ We like to party!
<div class="overflow-scroll ..."></div>

Responsive design

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

<div class="overflow-auto md:overflow-scroll">  <!-- ... --></div>

Learn more about using variants in the variants documentation.

Copyright © 2024 Tailwind Labs Inc.·Trademark Policy