Overflow & visibility
What happens to content that doesn't fit, and hiding things while keeping their space.
<div class="grid md:grid-cols-2 gap-4">
<div class="overflow-auto bg-1 rounded-lg p-3 h-28">
<div class="text-sm">overflow-auto: scrolls when it has to. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. </div>
</div>
<div class="overflow-hidden bg-1 rounded-lg p-3 h-28">
<div class="text-sm">overflow-hidden: cuts it off. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. Lots of text that keeps going. </div>
</div>
</div>
overscroll-contain stops a scrolling panel from scrolling the page behind it when it reaches the end — good for sidebars and chat lists.
Visibility
<div class="flex gap-2">
<div>1</div>
<div class="invisible">2</div>
<div>3</div>
</div>
invisible hides it but keeps its space; hidden removes it; visually-hidden hides it on screen but keeps it for screen readers.
Float
Text flows around a floated box, the way magazine layouts wrap text around a photo. Text flows around a floated box, the way magazine layouts wrap text around a photo. Text flows around a floated box, the way magazine layouts wrap text around a photo.
<div class="flow-root">
<div class="float-end ms-3 mb-2 cell size-20 p-0"></div>
<p class="text-sm m-0">Text flows around a floated box, the way magazine layouts wrap text around a photo. Text flows around a floated box, the way magazine layouts wrap text around a photo. Text flows around a floated box, the way magazine layouts wrap text around a photo. </p>
</div>
Scroll sideways
overflow-x-auto on a wide row: it scrolls on its own instead of pushing the page sideways — chips, tabs, wide tables.
<div class="overflow-x-auto overscroll-contain">
<div class="flex gap-2 w-max">
<div>Overview</div>
<div>Orders</div>
<div>Customers</div>
<div>Products</div>
<div>Invoices</div>
<div>Reports</div>
<div>Discounts</div>
<div>Settings</div>
<div>Integrations</div>
</div>
</div>
Clip vs hidden
overflow-clip cuts content off like overflow-hidden, but the box can never be scrolled — not even by code or by focusing something inside.
| Class | Does |
|---|---|
overflow-auto · overflow-hidden · overflow-clip · overflow-visible · overflow-scroll (+ overflow-x-* · overflow-y-*) | overflow · with breakpoints |
overscroll-auto · overscroll-contain · overscroll-none | scroll chaining |
visible · invisible | visibility |
float-start · float-end · float-none · clear-both · flow-root | float |