Overflow-Y Property

Last updated: 2026-09-13

overflow-y Overflow-Y Property

The overflow-y property controls specifically how content overflowing a container vertically is handled and accepts the same values as overflow. The default value, visible, lets the overflow show. It is the most commonly used overflow control and is often paired with max-height for scrollable regions of a fixed height.

Category
Initial Valuevisible
InheritedNo
Applies Toblock-container
Animation Typediscrete
CSS VersionCSS3
StatusStandard

📝 Syntax

overflow-y: visible | hidden | clip | scroll | auto;

⚙️ Values

ValueTypeDescription
visible | hidden | scroll | autoKeywordVertical overflow handling.

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
overflow-y v4 v12 v1 v3.1 v10
Supported in all major browsers
Tip: overflow-y:auto hides the scrollbar when content does not overflow and shows it only when it does, which looks nicer than scroll.

❓ FAQ

QHow do I make a div's content scroll when it overflows?
AGive the div a height limit plus overflow-y:auto, for example .list { max-height:300px; overflow-y:auto; }. When content exceeds the height, a vertical scrollbar appears; when it does not, no scrollbar shows. Prefer max-height over height so short content leaves no empty space. This is the standard pattern for chat windows, notification lists, and similar scrolling panels, and it degrades gracefully since the container simply grows when overflow is unsupported.
QWhat does overflow-y:hidden do?
AVertically overflowing content is clipped and hidden, and users cannot scroll to see the cut-off portion. It suits fixed display areas where content is guaranteed to fit, like a fixed-height banner, or regions with JS-controlled scrolling. Note that it disables scrolling entirely: if you just want to hide the scrollbar while keeping scrolling, for a custom scrollbar, overflow-y:hidden will not do; you need a visible and scroll container trick instead.
QWhat's the difference between overflow-y:auto and overflow-y:scroll?
Ascroll always shows a vertical scrollbar, even when content does not overflow, so the scrollbar track is permanently reserved. auto shows the scrollbar only when content overflows and hides it otherwise. Visually, auto is cleaner with no leftover track, which is why it is recommended for everyday layouts. scroll suits cases where you want to signal that the region scrolls, such as tutorial panels.
QCan overflow-x and overflow-y be set together?
AYes, but with one rule: when both are visible, content overflows normally; as soon as one axis is not visible, the other axis's visible is automatically rewritten to auto. For example, overflow-x:hidden; overflow-y:visible actually becomes overflow-y:auto. This is why you may see unexpected auto scrollbars after setting a single axis, and it also means you cannot combine a truly visible vertical overflow with a clipped horizontal one.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏