The overflow-block media feature detects how a device handles content that overflows along the block axis — usually vertical scrolling on screens or page breaks when printing.
01
@media
Media query.
02
scroll
Scrollable.
03
paged
Page breaks.
04
Block axis
Flow direction.
05
vs inline
Two axes.
06
Print
Paginated UI.
Fundamentals
Introduction
When a webpage has more content than fits on screen, most browsers let you scroll vertically to see the rest. Printers handle overflow differently — they split content across pages.
The @media (overflow-block) feature lets CSS detect that behavior. It answers: “How does this device show content that overflows along the block axis?”
Definition and Usage
Wrap rules in @media (overflow-block: scroll), @media (overflow-block: paged), or the other accepted values. On laptops and phones, you will almost always match scroll. Print output often matches paged.
💡
Beginner Tip
This feature does not check whether your page currently overflows. It reports the device’s capability for handling block-axis overflow. Do not confuse it with the overflow CSS property, which styles one element.
Foundation
📝 Syntax
Use a keyword value inside an @media rule:
syntax.css
@media(overflow-block:scroll){/* Styles for scrollable block overflow */}@media(overflow-block:paged){/* Styles for paginated block overflow */}
Accepted Values
none — Overflow along the block axis is not displayed.
scroll — Users can scroll to reach overflowing content (typical on screens).
optional-paged — Content may paginate but can still scroll on devices like computers.
paged — Content is broken into discrete pages (common in print).
Block Axis vs Inline Axis
Block axis Vertical in English overflow-block
Inline axis Horizontal in English overflow-inline
overflow-block vs overflow Property
@media (overflow-block: scroll) Device capability query — “Can users scroll block-axis overflow on this output device?”
overflow: auto; Element styling — controls clipping and scrollbars on one box.
overflow-block vs overflow-inline
(overflow-block: scroll) Block-axis overflow — usually vertical scrolling in horizontal writing modes.
(overflow-inline: scroll) Inline-axis overflow — usually horizontal scrolling in horizontal writing modes.
On most screens both features match scroll. The distinction matters when one axis paginates and the other scrolls.
Tips
🛠 Usage Tips
Start with scroll — Most users browse on scroll-capable screens; treat scroll as your default assumption.
Layer print CSS — Combine overflow-block: paged with @media print for robust print layouts.
Progressive enhancement — Base styles should work everywhere; add scroll-specific polish when scroll matches.
Test print preview — Use the browser print dialog to verify paged rules.
Pair with overflow-inline — Handle horizontal and vertical overflow capabilities separately.
Watch Out
⚠️ Common Pitfalls
Confusing with overflow property — overflow-block is a media feature, not element styling.
Expecting runtime overflow detection — It reports device capability, not whether content currently overflows.
Ignoring writing-mode — Block axis direction changes in vertical writing systems.
Only testing on screen — paged rules matter for print even if they never match on your monitor.
Replacing @media print entirely — Use both print media type and overflow features where appropriate.
A11y
♿ Accessibility
Keyboard scrolling — Ensure scrollable layouts remain operable with keyboard and focus visible.
Print readability — Page-break rules should not split headings from their content.
Motion sensitivity — Scroll hints should not rely on animation alone to convey meaning.
Zoom support — Paginated and scroll layouts must tolerate text resizing.
Screen readers — Do not hide essential content on none devices without an alternative.
🧠 How overflow-block Works
1
Browser evaluates output device
Checks how block-axis overflow is presented — scroll, pages, or hidden.
Detect
2
Media query matches a keyword
scroll, paged, optional-paged, or none.
Match
3
@media rules apply
Matching blocks update backgrounds, hints, and page-break behavior.
Apply
=
📄
Medium-aware layout
CSS adapts to scroll screens and paginated print output.
Compatibility
🖥 Browser Compatibility
The overflow-block media feature reached Baseline status in September 2023. Modern browsers support it; older versions do not.
✓ Baseline · Since Sept 2023
Scroll & paged overflow queries
Chrome 113+, Firefox 66+, Safari 17+, Edge 113+.
92%Global support
overflow-block media feature92% supported
Bottom line: Safe for progressive enhancement today. Provide fallbacks for Safari 16 and older Chromium builds.
Wrap Up
🎉 Conclusion
The overflow-block media feature bridges screen and print design. It tells CSS whether block-axis overflow is scrollable, paginated, or hidden on the current output device.
Use it for scroll hints on screens, page-break polish for print, and axis-specific layouts alongside overflow-inline. Keep base styles universal and layer medium-specific rules on top.
Use these points when styling scroll screens and paginated output.
5
Core concepts
S01
scroll
Typical screens.
Value
P02
paged
Print output.
Value
B03
Block axis
Flow direction.
Concept
I04
overflow-inline
Partner feature.
Related
!05
Not overflow
Media feature.
Pitfall
FAQ
❓ Frequently Asked Questions
What does the CSS overflow-block media feature do?
The overflow-block media feature reports how the output device handles content that overflows along the block axis — the direction content flows in blocks (usually vertical in English). Values include scroll, paged, optional-paged, and none.
What values does overflow-block accept?
Four keyword values: none (overflow is not displayed), scroll (users can scroll to see overflow), optional-paged (may paginate but can scroll on screens), and paged (content is broken into discrete pages like print).
How is overflow-block different from the overflow CSS property?
The overflow property controls how one element clips or scrolls its own content. The overflow-block media feature describes the device's capability along the block axis — it does not set overflow on an element.
When should I use overflow-block in CSS?
Use it to tailor layouts for scrollable screens vs paginated print output, adjust long-form reading experiences on scroll devices, and pair with overflow-inline for axis-specific overflow behavior.
Is overflow-block widely supported in browsers?
Yes in modern browsers since 2023: Chrome 113+, Firefox 66+, Safari 17+, and Edge 113+. On most screens the matched value is scroll.