Recommended Free Tools
Use overflow: auto when a constrained box should scroll only if its content does not fit; use scroll for a scroll container even when content fits, hidden to clip while retaining programmatic scrolling, and clip for visual cropping without scrolling. The default, visible, lets content paint outside its box. The right choice depends on whether the content must remain reachable and which axis overflows.
What CSS overflow controls
The CSS Overflow Module Level 3 defines how block, flex, and grid containers handle content that extends beyond their box. The overflow shorthand sets both axes; overflow-x and overflow-y set horizontal and vertical behavior. These properties govern clipping and scrollable overflow, not the size of the box itself: a useful scroll area generally needs a constrained width, height, maximum size, or equivalent layout constraint. See the W3C CSS Overflow Module Level 3 and MDN’s overflow reference.
| Value | What it does | Use it when |
|---|---|---|
visible |
Does not clip; content may paint outside the box. Does not create a scroll container. | Content can extend beyond the box without disrupting the layout. |
auto |
Clips overflow and permits scrolling when needed. Scrollbars are typically shown only when content overflows. | A constrained panel should scroll only when its content requires it. |
scroll |
Creates a scroll container and requests scrollbars whether or not content overflows. Actual scrollbar presentation varies by browser and platform. | Persistent scrollbar behavior is intentional. |
hidden |
Clips content and hides scrollbars, but the box remains scrollable programmatically and may scroll to focused content. | Scrolling is needed through scripts or focus navigation, but visible scrollbars are not wanted. |
clip |
Clips at the overflow clip edge without creating a scroll container or allowing programmatic scrolling. | Content is deliberately cropped and does not need to be reached. |
Values other than visible and clip establish a new block formatting context. The behavior and accessibility trade-offs of each value are described in MDN’s reference.
Choose the right overflow value
Use auto for a normal scrollable panel
For content that must remain available but may exceed a panel’s size, constrain the box and use auto on the axis that should scroll. This is usually the best starting point for a panel that should not show a scrollbar unnecessarily.
#1 Best Overall
Use scroll only when persistent scrollbar behavior is intended
scroll requests a scrollbar even if the content currently fits. Browsers with overlay scrollbars may display that request differently, so it does not guarantee a visible, permanently occupying scrollbar on every platform. If the goal is to prevent layout shifts as a scrollbar comes and goes, consider scrollbar-gutter: stable with overflow: auto, as described in MDN’s guide to handling overflow.
Use hidden when clipping is intended but scrolling must still be possible
Although users do not see scrollbars, scripts can scroll an element with scrolling APIs, and focus navigation may bring focused content into view. Do not assume that hidden makes the clipped content unreachable.
Reserve clip for deliberate cropping
clip is not a scroll-free substitute for hidden: it does not create a scroll container and cannot be scrolled programmatically. Use it only when the cropped content is genuinely decorative or otherwise unnecessary to access.
Rank #2
Let content overflow with visible
The default visible value allows content to paint outside its box. That can work for intentional overlap, but it is not a way to create a scrollable area.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →How to make a div scroll
First give the element a size limit so its content can exceed the box; then set the intended overflow axis. These examples cover a vertically scrolling panel, a horizontally scrolling table wrapper, and a decorative crop:
.panel {
max-block-size: 24rem;
overflow-y: auto;
}
.table-wrapper {
max-width: 100%;
overflow-x: auto;
}
.decorative-crop {
overflow: clip;
}
A max-block-size lets a panel grow until it reaches its limit, after which vertical overflow can scroll. A maximum width similarly keeps a table wrapper within its available space. Without an effective size constraint, the box may grow with its contents instead of overflowing.
Set horizontal and vertical overflow deliberately
The shorthand accepts one value for both axes, or two values in horizontal-then-vertical order. For example, overflow: hidden auto sets horizontal overflow to hidden and vertical overflow to auto. The longhands make axis intent explicit, as in overflow-x: auto for a horizontally scrolling table.
There is an important computation rule: if one axis is neither visible nor clip, then visible on the other axis computes to auto, and clip computes to hidden. Consequently, this does not preserve visible vertical spill:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minute.example {
overflow-x: hidden;
overflow-y: visible; /* computes to auto */
}
To pair visible overflow on one axis with clipping on the other without that particular conversion, clip can pair with visible. Check the computed styles in browser developer tools when an axis behaves differently from the authored value. The axis rules are defined in the W3C specification and explained in MDN’s reference.
Rank #4
Keep scrollable content accessible
A scrollable region may not be keyboard-focusable by default in some browsers. If users need to operate it with a keyboard, consider making it focusable with tabindex="0". Give a significant region an accessible name, for example with role="region" and aria-label or aria-labelledby, so screen-reader users can identify it.
Take particular care with interactive content inside clipped regions. With hidden, moving focus may cause the region to scroll to that content. With clip, a focusable element can receive keyboard focus while remaining outside the visible area, making it inaccessible to keyboard users. Do not use clip for content people need to find or operate. MDN covers these focus and scrolling considerations in its overflow guidance.
Why a page has a horizontal scrollbar
A horizontal scrollbar means some content or layout is extending the scrollable area beyond the available width. Identify the overflowing element and address its cause rather than automatically hiding the page’s horizontal overflow: hiding it can conceal content that users need.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Best Value
- Check whether a child has a fixed or minimum width larger than its container or viewport.
- For long words or unbroken strings, consider
overflow-wraporword-breakbefore adding a horizontal scroll region. MDN discusses these options in Handling overflow. - For wide content that should retain its width, such as a table, constrain a wrapper and use
overflow-x: autoon that wrapper instead of forcing the entire page to scroll. - Inspect computed overflow values on both axes; a declared
visiblemay compute toautowhen paired with a non-visible, non-clipvalue.
Distinguish visible ink from scrollable overflow
A shadow or outline protruding beyond a box is not necessarily enlarging the scrollable area. Shadows, outlines, text decoration, border images, and overhanging glyphs are examples of ink overflow: they can paint outside the box without extending the scrollable overflow region. This distinction is set out in the MDN overflow guide.
Troubleshoot unexpected clipping or missing scrolling
- Check the constraint. Inspect the element’s computed width, height, and maximum sizes, then compare those with its content. If the box can grow freely, it may not overflow or scroll. See MDN’s property guidance.
- Identify the overflowing axis. Use
overflow-xoroverflow-yto express whether horizontal or vertical scrolling is intended. The specification defines the axis controls. - Inspect computed styles for both axes. A paired-axis computation rule can change
visibletoautoorcliptohidden. - Decide whether the content must stay reachable. Choose
autoorscrollfor user scrolling,hiddenwhen programmatic or focus scrolling is intended, andcliponly for content that can safely be cropped. - For long words or tokens, try wrapping first. Use
overflow-wraporword-breakwhen breaking the string is better than making the surrounding content horizontally scroll. See MDN’s overflow handling guide. - For scrollbar-related layout shifts, consider a stable gutter. Use
scrollbar-gutter: stablewithoverflow: autoif reserving scrollbar space is the goal.
Capture a page to inspect its rendered layout
A screenshot can help you inspect how overflow appears in a rendered page, although it does not replace checking computed styles, keyboard behavior, or scrolling interactively. For a reproducible capture, set the target URL and use the same viewport and page state when comparing changes.
Or skip the browser setup
ScreenshotNeo offers a screenshot API and MCP server for developers. One GET request can return an image or PDF; this cURL example saves a WebP screenshot of the target page. See the ScreenshotNeo documentation for the API details.
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Visit ScreenshotNeo or sign up free for 1,000 screenshots a month, no card.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




