Overflow
Overflow utilities control what happens when content is bigger than its box: overflow-auto scrolls when needed, overflow-hidden clips, overflow-visible lets content spill and overflow-scroll always shows scrollbars. overflow-x-* and overflow-y-* handle each axis separately, ideal for wide tables and side-scrolling rows.
1The four overflow values
overflow-auto, overflow-hidden, overflow-visible and overflow-scroll on boxes of fixed height.
overflow-autooverflow-hiddenoverflow-visibleoverflow-scroll<div class="row g-3 small">
<div class="col-6 col-md-3">
<code>overflow-auto</code>
<div class="overflow-auto border rounded-3 p-2 bg-body-tertiary" style="height:100px">
We find the best price, and if you see it cheaper we match it. Travel insurance and car rental can be added in a single click. Clear prices, honest advice and no surprises along the way. We find the best price, and if you see it cheaper we match it.
</div>
</div>
<div class="col-6 col-md-3">
<code>overflow-hidden</code>
<div class="overflow-hidden border rounded-3 p-2 bg-body-tertiary" style="height:100px">
We find the best price, and if you see it cheaper we match it. Travel insurance and car rental can be added in a single click. Clear prices, honest advice and no surprises along the way. We find the best price, and if you see it cheaper we match it.
</div>
</div>
<div class="col-6 col-md-3">
<code>overflow-visible</code>
<div class="overflow-visible border rounded-3 p-2 bg-body-tertiary mb-5" style="height:100px">
We find the best price, and if you see it cheaper we match it. Travel insurance and car rental can be added in a single click. Clear prices, honest advice and no surprises along the way. We find the best price, and if you see it cheaper we match it.
</div>
</div>
<div class="col-6 col-md-3">
<code>overflow-scroll</code>
<div class="overflow-scroll border rounded-3 p-2 bg-body-tertiary" style="height:100px">
We find the best price, and if you see it cheaper we match it. Travel insurance and car rental can be added in a single click. Clear prices, honest advice and no surprises along the way. We find the best price, and if you see it cheaper we match it.
</div>
</div>
</div>2Horizontal scroll only
overflow-x-auto with flex-nowrap scrolls a row of cards sideways.
<div class="d-flex flex-nowrap gap-2 overflow-x-auto pb-2">
<div class="border rounded-3 p-3 flex-shrink-0" style="width:160px">
<div class="fw-semibold small">
Car rental
</div>
</div>
<div class="border rounded-3 p-3 flex-shrink-0" style="width:160px">
<div class="fw-semibold small">
Car rental
</div>
</div>
<div class="border rounded-3 p-3 flex-shrink-0" style="width:160px">
<div class="fw-semibold small">
Hotel booking
</div>
</div>
<div class="border rounded-3 p-3 flex-shrink-0" style="width:160px">
<div class="fw-semibold small">
Guided tours
</div>
</div>
<div class="border rounded-3 p-3 flex-shrink-0" style="width:160px">
<div class="fw-semibold small">
Guided tours
</div>
</div>
</div>3Vertical scroll only
overflow-y-auto and a max-height make a scrolling list.
- Nora Morgan
- Mia Ashford
- Finn Silva
- Ava Delgado
- Lea Okafor
- Maya Moreau
<ul class="list-unstyled border rounded-3 overflow-y-auto mb-0" style="max-height:150px">
<li class="px-3 py-2 border-bottom">Nora Morgan</li>
<li class="px-3 py-2 border-bottom">Mia Ashford</li>
<li class="px-3 py-2 border-bottom">Finn Silva</li>
<li class="px-3 py-2 border-bottom">Ava Delgado</li>
<li class="px-3 py-2 border-bottom">Lea Okafor</li>
<li class="px-3 py-2">Maya Moreau</li>
</ul>4Hidden to clip rounded corners
overflow-hidden on a rounded card clips the image corners.
<div class="row g-3">
<div class="col-6">
<div class="border rounded-4">
<img src="https://images.unsplash.com/photo-1614088459293-5669fadc3448?auto=format&fit=crop&w=1200&h=800&q=70" alt="Not clipped" class="w-100 d-block">
<div class="p-2 small">
without
</div>
</div>
</div>
<div class="col-6">
<div class="border rounded-4 overflow-hidden">
<img src="https://images.unsplash.com/photo-1783443076547-fb9cb67224a0?auto=format&fit=crop&w=1200&h=800&q=70" alt="Clipped" class="w-100 d-block">
<div class="p-2 small">
overflow-hidden
</div>
</div>
</div>
</div>5Wide table
A wide table inside overflow-x-auto scrolls instead of breaking the page.
| Order | Customer | City | Date | Status | Total |
|---|---|---|---|---|---|
| #PO-7376 | Tariq Kim | Melbourne | Oct 7, 2026 | Active | $744.08 |
| #TX-4434 | Amara Duarte | Edinburgh | Oct 16, 2025 | Active | $646.44 |
<div class="overflow-x-auto border rounded-3">
<table class="table table-sm mb-0 text-nowrap">
<thead>
<tr>
<th scope="col">Order</th>
<th scope="col">Customer</th>
<th scope="col">City</th>
<th scope="col">Date</th>
<th scope="col">Status</th>
<th scope="col">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>#PO-7376</td>
<td>Tariq Kim</td>
<td>Melbourne</td>
<td>Oct 7, 2026</td>
<td>Active</td>
<td>$744.08</td>
</tr>
<tr>
<td>#TX-4434</td>
<td>Amara Duarte</td>
<td>Edinburgh</td>
<td>Oct 16, 2025</td>
<td>Active</td>
<td>$646.44</td>
</tr>
</tbody>
</table>
</div>6Code block that scrolls
Long lines in a pre with overflow-x-auto stay on one line.
npm run build -- --mode production --out-dir dist/yarais --base ./ --sourcemap false --emptyOutDir<pre class="overflow-x-auto bg-body-tertiary border rounded-3 p-3 small mb-0"><code>npm run build -- --mode production --out-dir dist/yarais --base ./ --sourcemap false --emptyOutDir</code></pre>7Chat window
A fixed height message area with overflow-y-auto above a fixed input.
<div class="border rounded-4 d-flex flex-column" style="height:220px;max-width:22rem">
<div class="overflow-y-auto p-3 d-flex flex-column gap-2 flex-grow-1">
<div class="align-self-start bg-body-tertiary rounded-3 px-2 py-1 small">
Friendly people answer your questions quickly, by phone, chat or email.
</div>
<div class="align-self-end text-bg-primary rounded-3 px-2 py-1 small">
We keep things simple, so you can focus on what matters to you.
</div>
<div class="align-self-start bg-body-tertiary rounded-3 px-2 py-1 small">
Airport transfers, tours and dinners are arranged before you arrive.
</div>
<div class="align-self-end text-bg-primary rounded-3 px-2 py-1 small">
Local guides show you the places that never make it into guidebooks.
</div>
</div>
<div class="border-top p-2">
<label class="visually-hidden" for="ut-msg-1253">Message</label>
<input id="ut-msg-1253" type="text" class="form-control form-control-sm" placeholder="Type a message">
</div>
</div>8Scrollable tab strip
Pills in a flex-nowrap row with overflow-x-auto for many categories.
<nav class="d-flex flex-nowrap gap-2 overflow-x-auto pb-1" aria-label="Categories">
<a href="#" class="btn btn-sm btn-primary rounded-pill text-nowrap">All</a> <a href="#" class="btn btn-sm btn-light border rounded-pill text-nowrap">Beach</a> <a href="#" class="btn btn-sm btn-light border rounded-pill text-nowrap">insights</a> <a href="#" class="btn btn-sm btn-light border rounded-pill text-nowrap">City</a> <a href="#" class="btn btn-sm btn-light border rounded-pill text-nowrap">news</a> <a href="#" class="btn btn-sm btn-light border rounded-pill text-nowrap">workflow</a> <a href="#" class="btn btn-sm btn-light border rounded-pill text-nowrap">modern</a>
</nav>9Terms box
A long text inside a bordered box with overflow-auto, like a licence agreement.
Terms of use
Free cancellation on most stays means you can book now and decide later. From city breaks to safaris, we plan trips around how you like to travel. Our team has done this many times, so you never have to guess.
Our travel experts are on call around the clock while you are away. Family rooms, adults-only retreats and pet-friendly stays in one search. We measure success by how many travellers come back and tell their friends.
Thousands of travellers already trust us, and we work hard to keep it that way. Members get room upgrades and late check-out at selected hotels. Flexible dates help you find quieter weeks and better prices.
<div class="border rounded-3 p-3 overflow-auto small bg-body-tertiary" style="height:130px">
<h3 class="h6">Terms of use</h3>
<p>Free cancellation on most stays means you can book now and decide later. From city breaks to safaris, we plan trips around how you like to travel. Our team has done this many times, so you never have to guess.</p>
<p>Our travel experts are on call around the clock while you are away. Family rooms, adults-only retreats and pet-friendly stays in one search. We measure success by how many travellers come back and tell their friends.</p>
<p class="mb-0">Thousands of travellers already trust us, and we work hard to keep it that way. Members get room upgrades and late check-out at selected hotels. Flexible dates help you find quieter weeks and better prices.</p>
</div>10Visible overflow for a badge
overflow-visible lets a badge stick out of a box that would otherwise clip it.
<div class="d-flex gap-4 pt-2">
<div class="position-relative overflow-hidden border rounded-3 p-3 small">
overflow-hidden<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill text-bg-danger">7</span>
</div>
<div class="position-relative overflow-visible border rounded-3 p-3 small">
overflow-visible<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill text-bg-danger">5</span>
</div>
</div>11Hidden overflow for a cropped title
overflow-hidden with a fixed height clips long text to two lines worth of space.
<div class="border rounded-3 p-3" style="max-width:20rem">
<div class="overflow-hidden fw-semibold lh-sm" style="height:2.5em">
Small hotels with big character - We listen first, then build a plan around what you actually need.
</div>
<div class="small text-body-secondary mt-1">
Aug 13, 2026
</div>
</div>12Sidebar that scrolls separately
The nav column scrolls with overflow-y-auto while the content stays put.
<div class="d-flex border rounded-3" style="height:180px">
<nav class="overflow-y-auto border-end p-2 small flex-shrink-0" style="width:130px" aria-label="Chapters">
<a href="#" class="d-block py-1">Intro</a><a href="#" class="d-block py-1">Setup</a><a href="#" class="d-block py-1">Layout</a> <a href="#" class="d-block py-1">Colours</a><a href="#" class="d-block py-1">Forms</a><a href="#" class="d-block py-1">Tables</a> <a href="#" class="d-block py-1">Charts</a><a href="#" class="d-block py-1">Deploy</a>
</nav>
<div class="p-3 small">
Every hotel on our list is visited and reviewed by our own travel team. Every detail is handled by people who care about getting it right.
</div>
</div>13Image pan area
A large image in an overflow-auto box can be scrolled in both directions.
<div class="overflow-auto border rounded-3" style="height:160px;max-width:26rem">
<img src="https://images.unsplash.com/photo-1605130284535-11dd9eedc58a?auto=format&fit=crop&w=1600&h=700&q=70" alt="How to choose the right trip" width="900" height="394" class="d-block">
</div>14Kanban columns
Columns side by side in overflow-x-auto, each column scrolls with overflow-y-auto.
<div class="d-flex gap-2 overflow-x-auto pb-1">
<div class="bg-body-tertiary rounded-3 p-2 flex-shrink-0 overflow-y-auto" style="width:170px;max-height:180px">
<div class="small fw-semibold mb-2">
To do
</div>
<div class="bg-body border rounded-2 p-2 small mb-2">
Holiday packages
</div>
<div class="bg-body border rounded-2 p-2 small mb-2">
Airport transfers
</div>
<div class="bg-body border rounded-2 p-2 small">
Airport transfers
</div>
</div>
<div class="bg-body-tertiary rounded-3 p-2 flex-shrink-0 overflow-y-auto" style="width:170px;max-height:180px">
<div class="small fw-semibold mb-2">
Doing
</div>
<div class="bg-body border rounded-2 p-2 small">
Holiday packages
</div>
</div>
<div class="bg-body-tertiary rounded-3 p-2 flex-shrink-0 overflow-y-auto" style="width:170px;max-height:180px">
<div class="small fw-semibold mb-2">
Done
</div>
<div class="bg-body border rounded-2 p-2 small">
Airport transfers
</div>
</div>
</div>15Overflow-x hidden
overflow-x-hidden hides content that slides in from the side, like an off-screen panel.
<div class="position-relative overflow-x-hidden border rounded-3 p-3" style="height:110px">
<div class="small">
Every trip supports local businesses and responsible tourism.
</div>
<div class="position-absolute top-0 bg-primary-subtle h-100 p-2 small" style="left:90%;width:200px">
Panel partly off the edge
</div>
</div>16Overflow-y scroll always
overflow-y-scroll always shows the vertical scrollbar, so the width never jumps.
<div class="overflow-y-scroll border rounded-3 p-2 small" style="height:90px">
Start in minutes and get help from a real person whenever you need it.
</div>17Notification panel
A dropdown-like panel with header, scrolling body and footer.
<div class="border rounded-3 shadow-sm d-flex flex-column" style="max-width:20rem;height:220px">
<div class="px-3 py-2 border-bottom fw-semibold small">
Notifications
</div>
<div class="overflow-y-auto flex-grow-1">
<div class="px-3 py-2 border-bottom small">
Airport transfers, tours and dinners are arranged before you arrive.
</div>
<div class="px-3 py-2 border-bottom small">
Flexible dates help you find quieter weeks and better prices.
</div>
<div class="px-3 py-2 border-bottom small">
We keep things simple, so you can focus on what matters to you.
</div>
<div class="px-3 py-2 small">
Travel insurance and car rental can be added in a single click.
</div>
</div>
<a href="#" class="px-3 py-2 border-top small text-center">View all</a>
</div>18Clip a decorative shape
A big circle partly outside its panel is cut off by overflow-hidden.
Pack your bags, we will do the rest
Our team has done this many times, so you never have to guess.
<div class="position-relative overflow-hidden text-bg-primary rounded-4 p-4">
<div class="position-absolute bg-white bg-opacity-25 rounded-circle" style="width:180px;height:180px;right:-60px;top:-60px">
</div>
<h3 class="h5 position-relative">Pack your bags, we will do the rest</h3>
<p class="small mb-0 position-relative">Our team has done this many times, so you never have to guess.</p>
</div>19Long word handling
overflow-hidden plus text-truncate versus text-break for an unbreakable string.
<div class="row g-2 small">
<div class="col-sm-6">
<div class="border rounded-3 p-2 text-truncate">
downloads/yarais/assets/very-long-file-name-without-any-spaces-at-all.zip
</div>
</div>
<div class="col-sm-6">
<div class="border rounded-3 p-2 text-break">
downloads/yarais/assets/very-long-file-name-without-any-spaces-at-all.zip
</div>
</div>
</div>20Responsive table wrapper
table-responsive is the helper made of overflow-x-auto for tables.
| Plan | Users | Storage | Support | API | Price |
|---|---|---|---|---|---|
| Pro | 7 | 431 GB | Email and chat | Unlimited | $29.90 |
<div class="table-responsive border rounded-3">
<table class="table table-sm mb-0 text-nowrap">
<thead>
<tr>
<th scope="col">Plan</th>
<th scope="col">Users</th>
<th scope="col">Storage</th>
<th scope="col">Support</th>
<th scope="col">API</th>
<th scope="col">Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Pro</td>
<td>7</td>
<td>431 GB</td>
<td>Email and chat</td>
<td>Unlimited</td>
<td>$29.90</td>
</tr>
</tbody>
</table>
</div>