The overflow-y property controls what happens when content overflows a block-level element’s top and bottom edges. You can let it paint outside, clip it, or allow vertical scrolling.
The initial value is visible. It is the vertical half of the overflow shorthand; pair it with overflow-x when axes must differ. The box needs a limited height or max-height or nothing overflows vertically.
Baseline · Widely available.
Not deprecated. Core keywords are standard-track. clip is widely available in modern browsers (Chrome 90+, Firefox 81+, Safari 16+). Deprecated / discouraged:overlay is a legacy alias for auto — do not use it in new code.
Put content inside that is taller than that limit.
Set overflow-y to auto, scroll, hidden, clip, or visible.
Set overflow-x separately when horizontal behavior must differ, or use the overflow shorthand for both axes.
Piece
Required?
Role
Height constraint
Yes (to overflow)
Without a limit, the box grows and nothing overflows
Tall content
Yes (to observe)
More lines than the box height creates overflow
Keyword
Yes
Decides paint outside, clip, or vertical scroll
overflow-x
Often
A non-visible overflow-x can change how visible computes
Try it
Live Preview
A short box holds several lines. Change overflow-y and watch how the extra height behaves.
Height stays fixed. Only the vertical overflow keyword changes.
Box
Line 1 — this box is short. Line 2 — extra lines overflow. Line 3 — try each keyword. Line 4 — compare clip and scroll. Line 5 — auto shows a bar when needed.
overflow-y: auto
Code
CSS Examples
Each snippet focuses on overflow-y. The fixed height is only there so content can overflow vertically. Use Try It Yourself for a live editor.
Example 1 — Scroll When Needed
Show a vertical scrollbar only if the text is taller than the box.
CSS
<style>
div {
height: 80px;
overflow-y: auto;
border: 1px solid #cbd5e1;
padding: 8px;
}
</style>
<div>
This box is short. Extra lines overflow, so auto adds a scrollbar when needed.
</div>
This box is short. Extra lines overflow, so auto adds a scrollbar when needed. Keep scrolling to read the rest of the sample text inside the box.
How It Works
Limit the height.height: 80px stops the box from growing with the text.
Put in more content. The paragraph is taller than 80px, so it overflows.
Choose auto.overflow-y: auto clips the extra lines and shows a scrollbar only because it is needed.
Scroll to read. The clipped lines stay reachable with vertical scroll.
Example 2 — Clip Without Scrollbars
Hide anything that sticks out on the top or bottom. No scrollbar appears.
CSS
<style>
div {
height: 80px;
overflow-y: hidden;
border: 1px solid #cbd5e1;
padding: 8px;
}
</style>
<div>
Extra text is clipped at the edge of this box. There is no scrollbar.
</div>
This box always acts as a scroll container. Scrollbars typically stay visible, even when content is short, depending on the browser and OS.
How It Works
Set overflow-y to scroll. The element is always a vertical scroll container.
Clip at the padding box. Extra height stays inside the scrollable area.
Expect scrollbar UI. Many browsers reserve vertical scrollbar space even when content fits, which avoids layout jump.
Prefer auto for most UI. Use scroll when you want the vertical track to stay stable.
Edge Cases & Pitfalls
If vertical overflow looks wrong, one of these is usually why.
height
No height limit, no overflow
Block boxes grow with content by default. Set a height or max-height before judging the keyword.
axes
visible can compute to auto
If overflow-x is hidden, scroll, or auto, a paired overflow-y: visible is computed as auto. Check both axes when results look unexpected.
hidden
hidden is not the same as clip
Both clip vertically. clip is not a scroll container and blocks programmatic scrolling. Prefer clip only when you want a hard non-scrolling clip.
a11y
Make scroll areas keyboard-reachable
Some browsers do not focus scrollable boxes by default. For important vertical scroll regions, consider tabindex="0", a landmark role, and an accessible name.
overlay
overlay is discouraged
Treat overlay as a deprecated legacy alias of auto. Use auto in new CSS.
Compatibility
Browser Support
overflow-y is a browser CSS property for vertical clipping and scrolling. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
overflow-y
Core values work in all modern browsers and Internet Explorer. overflow-y: clip needs Chrome 90+, Firefox 81+, Safari 16+, Edge 90+.
97%Core keyword support
Google ChromeAll · clip 90+
Full support
Mozilla FirefoxAll · clip 81+
Full support
Apple SafariAll · clip 16+
Full support
Microsoft EdgeAll · clip 90+
Full support
OperaModern · clip 76+
Full support
Samsung InternetAll · clip 15+
Full support
Internet Explorer6+ · No clip
Partial
overflow-yWidely supported
Bottom line: Safe for visible, hidden, scroll, and auto everywhere you teach CSS. Use clip in modern browsers; fall back to hidden when needed. It is not a runtime API.
Remember
Key Takeaways
Role: control vertical overflow on the top and bottom edges only.
Initial value:visible. Constrain height or nothing overflows.
auto vs scroll: auto when needed; scroll to keep a stable vertical track.
Pair with overflow-x: a non-visible horizontal value can change how visible computes.
One line: constrain height first, then pick a keyword — without a height limit, vertical overflow never shows.
Frequently Asked Questions
It controls what happens when content is too tall for the element's padding box on the top and bottom edges: show it, clip it, or allow vertical scrolling.
The initial value is visible. Content can paint outside the box vertically, and the element is not a vertical scroll container by itself.
overflow is the shorthand for both axes. overflow-y sets only the vertical axis; overflow-x sets only the horizontal axis.
scroll typically keeps a vertical scrollbar track visible even when content fits. auto shows a vertical scrollbar only when content actually overflows.
If overflow-x is hidden, scroll, or auto, a paired overflow-y: visible is computed as auto. Browsers do not keep one axis fully visible while the other is a scroll/clip mode.
Core values are Baseline Widely available across modern browsers and Internet Explorer. overflow-y: clip needs Chrome 90+, Firefox 81+, or Safari 16+. It is a browser CSS property, not a Node.js feature.