Overflow - Tailwind CSS

ClassStyles
overflow-autooverflow: auto;
overflow-hiddenoverflow: hidden;
overflow-clipoverflow: clip;
overflow-visibleoverflow: visible;
overflow-scrolloverflow: scroll;
overflow-x-autooverflow-x: auto;
overflow-y-autooverflow-y: auto;
overflow-x-hiddenoverflow-x: hidden;
overflow-y-hiddenoverflow-y: hidden;
overflow-x-clipoverflow-x: clip;
overflow-y-clipoverflow-y: clip;
overflow-x-visibleoverflow-x: visible;
overflow-y-visibleoverflow-y: visible;
overflow-x-scrolloverflow-x: scroll;
overflow-y-scrolloverflow-y: scroll;

Examples

Showing content that overflows

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

Andrew AlfredTechnical advisor<div class="overflow-visible ..."> <!-- ... --></div>

Note that any content that overflows the bounds of the element will then be visible.

Hiding content that overflows

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

Andrew AlfredTechnical 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:

Scroll vertically

Andrew AlfredTechnical advisorDebra HoustonAnalystJane WhiteDirector, MarketingRay FlintTechnical Advisor<div class="overflow-auto ..."> <!-- ... --></div>

Unlike overflow-scroll, which always shows scrollbars, this utility will only show them if scrolling is necessary.

Scrolling horizontally if needed

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

Scroll horizontally

AndrewEmilyWhitneyDavidKristinSarah<div class="overflow-x-auto ..."> <!-- ... --></div>

Scrolling vertically if needed

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

Scroll vertically

Andrew AlfredTechnical advisorDebra HoustonAnalystJane WhiteDirector, MarketingRay FlintTechnical 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:

Scroll horizontally

AndrewEmilyWhitneyDavidKristinSarah<div class="overflow-x-scroll ..."> <!-- ... --></div>

Scrolling vertically always

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

Scroll vertically

Andrew AlfredTechnical advisorDebra HoustonAnalystJane WhiteDirector, MarketingRay FlintTechnical Advisor<div class="overflow-y-scroll ..."> <!-- ... --></div>

Scrolling in all directions

Use the overflow-scroll utility to add scrollbars to an element:

Scroll vertically and horizontally

SunMonTueWedThuFriSat5 AM6 AM7 AM8 AM9 AM10 AM11 AM12 PM1 PM2 PM3 PM4 PM5 PM6 PM7 PM8 PM5 AMFlight to VancouverToronto YYZ6 AMBreakfastMel's Diner5 PM🎉 Party party 🎉We like to party!<div class="overflow-scroll ..."> <!-- ... --></div>

Unlike overflow-auto, which only shows scrollbars if they are necessary, this utility always shows them. Note that some operating systems (like macOS) hide unnecessary scrollbars regardless of this setting.

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.

Tag » How To Make A Scroll