Overview
Use overflow utilities to control how content behaves when it exceeds the boundaries of its container. These utilities are essential for creating scrollable areas, hiding overflow, and managing content that doesn’t fit.Overflow Utilities
Overflow Properties
.overflow-hidden | Hidden | overflow: hidden; | Hide overflowing content |
.overflow-auto | Auto | overflow: auto; | Show scrollbars when needed |
Overflow Hidden
Use.overflow-hidden to clip any content that overflows the container. The overflowing content will be completely hidden and not accessible via scrolling.
Common Use Cases
- Image containers that need to crop content
- Creating clean edges on rounded containers
- Hiding content that extends beyond boundaries
- Creating card layouts with consistent heights
Overflow Auto
Use.overflow-auto to show scrollbars automatically when content overflows. Scrollbars only appear when needed, keeping the interface clean when content fits.
Common Use Cases
- Scrollable content areas
- Sidebars with long navigation lists
- Modal content that might exceed viewport height
- Code blocks or preformatted text
Overflow Examples
Image Gallery with Hidden Overflow
Scrollable Content Area
Card with Hidden Overflow
Modal with Scrollable Content
Best Practices
1
Use Hidden for Images
Combine
.overflow-hidden with .object-cover for image containers to create clean, cropped images.2
Use Auto for Scrollable Content
Use
.overflow-auto for content areas that might exceed their container height, ensuring users can access all content.3
Consider Mobile
Test overflow behavior on mobile devices where screen space is limited.
4
Maintain Accessibility
Ensure scrollable content is keyboard accessible and screen reader friendly.

