Overflow Behavior
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 34 of 55.
A short container with overflow-auto gains a scroll mechanism when its content exceeds the available size. overflow-hidden clips the excess instead, while overflow-visible allows it to paint outside.
<div class="w-80 h-20 overflow-auto">Museum sample</div>Choose the axis deliberately. overflow-x-auto can preserve access to a wide table without forcing the whole page to become wide. A scrollable region still needs a size constraint for overflow to occur.
Challenge
MediumKeep the wide route strip inside its 320-pixel viewport: allow horizontal scrolling and hide vertical overflow.
Keep the supplied content and element IDs. Edit the HTML utility classes or the requested CSS. Click Run preview to refresh the preview after edits, then use Check/Run code to grade your work.
Try it yourself
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Practice studio</title><link rel="stylesheet" href="./styles.css"></head><body>
<div id="target" class="w-80 h-20"><div class="w-[800px]">North station | Museum | Garden | River | South station</div></div>
</body></html>
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
1Meet Tailwind
A Styled First RunChoosing UtilitiesCombining UtilitiesThe Local StylesheetRecap: Meet Tailwind7Sizing and Overflow
Element WidthElement HeightMaximum WidthOverflow BehaviorRecap: Sizing and Overflow