CSS overflow-block Media Feature

Beginner
⏱️ 7 min read
📚 Updated: Jul 2026
🎯 4 Examples
Media Queries

What You’ll Learn

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.

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.

📝 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.

Basic Example

overflow-block-basic.css
@media (overflow-block: scroll) {
  body {
    background-color: #dbeafe;
  }
}

@media (overflow-block: paged) {
  body {
    background-color: #fef3c7;
  }
}

Default Value

There is no CSS default for overflow-block. The browser evaluates the output device at runtime. Most screens report scroll.

Syntax Rules

  • Use keyword values only: none, scroll, optional-paged, paged.
  • Block axis follows writing-mode — vertical text uses a horizontal block axis.
  • Combine with overflow-inline for axis-specific layouts.
  • Pair with @media print for print stylesheets that complement paged output.
  • Do not use this to detect whether a specific element overflows — use JavaScript or layout techniques instead.

Related Topics

@media (overflow-block: scroll) @media (overflow-block: paged) @media (overflow-block: none)

⚡ Quick Reference

QuestionAnswer
Feature nameoverflow-block
What it measuresHow the device handles block-axis overflow
Typical screensscroll
Typical printpaged
All valuesnone, scroll, optional-paged, paged
Partner featureoverflow-inline
Browser supportChrome 113+, Firefox 66+, Safari 17+, Edge 113+

When to Use overflow-block

Reach for overflow-block when output medium affects reading or layout:

  • Scrollable screens — Optimize long articles, sticky headers, and scroll hints when scroll matches.
  • Print stylesheets — Apply page-break rules when paged matches.
  • E-readers and paginated UIs — Simplify navigation when content is presented as pages.
  • Progressive enhancement — Provide richer scroll UX only on scroll-capable devices.
  • Writing modes — Adapt block-axis behavior in vertical or mixed writing systems.

👀 Live Preview

On most screens this block matches overflow-block: scroll and turns blue. In print preview it may match paged instead:

Block Overflow Demo Your device’s block-axis overflow capability Matched: (overflow-block: scroll) Matched: (overflow-block: paged) Matched: (overflow-block: optional-paged) Matched: (overflow-block: none)

Examples Gallery

Practice overflow-block with scroll backgrounds, print page breaks, scroll hints, and inline-axis comparisons.

📜 Core Patterns

Style pages based on block-axis overflow behavior.

Example 1 — Background on scrollable devices

Apply a light blue background when the device supports scrolling along the block axis:

overflow-block-scroll.css
@media (overflow-block: scroll) {
  body {
    background-color: #dbeafe;
  }
}
Try It Yourself

How It Works

This is the classic beginner demo from the reference tutorial. On laptops and phones, scroll matches immediately.

Example 2 — Print page-break rules for paged output

When block overflow is paginated, avoid awkward breaks inside figures and headings:

overflow-block-paged.css
@media (overflow-block: paged) {
  article {
    page-break-inside: avoid;
  }

  h1, h2 {
    page-break-after: avoid;
  }
}
Try It Yourself

How It Works

Use print preview (Ctrl+P) to test. Paginated devices and print contexts match paged instead of scroll.

Example 3 — Scroll hint for long content

Show a “scroll down” hint only on scroll-capable block overflow:

overflow-block-hint.css
.scroll-hint {
  display: none;
  text-align: center;
  padding: 0.5rem;
  color: #64748b;
  font-size: 0.875rem;
}

@media (overflow-block: scroll) {
  .scroll-hint {
    display: block;
  }
}
Try It Yourself

How It Works

Hide scroll hints on paginated devices where vertical scrolling is not the primary navigation pattern.

Example 4 — overflow-block vs overflow-inline

Style block-axis and inline-axis scroll capabilities independently:

overflow-block-vs-inline.css
.block-axis {
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
}

@media (overflow-block: scroll) {
  .block-axis {
    background: #dbeafe;
    border-color: #93c5fd;
  }
}

@media (overflow-inline: scroll) {
  .inline-axis {
    background: #dcfce7;
    border-color: #86efac;
  }
}
Try It Yourself

How It Works

On most screens both features match scroll. The distinction matters when one axis paginates and the other scrolls.

🛠 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.

⚠️ Common Pitfalls

  • Confusing with overflow propertyoverflow-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 screenpaged 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.

♿ 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.

🖥 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 feature 92% supported

Bottom line: Safe for progressive enhancement today. Provide fallbacks for Safari 16 and older Chromium builds.

🎉 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.

💡 Best Practices

✅ Do

  • Assume scroll on screens
  • Test print preview
  • Use with overflow-inline
  • Progressive enhancement
  • Respect writing-mode

❌ Don’t

  • Confuse with overflow property
  • Detect element overflow
  • Hide content on none only
  • Skip print testing
  • Replace @media print

Key Takeaways

Knowledge Unlocked

Five things to remember about overflow-block

Use these points when styling scroll screens and paginated output.

5
Core concepts
P 02

paged

Print output.

Value
B 03

Block axis

Flow direction.

Concept
I 04

overflow-inline

Partner feature.

Related
! 05

Not overflow

Media feature.

Pitfall

❓ 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.

Practice in the Live Editor

Open the HTML editor and experiment with @media (overflow-block: scroll) and print page-break rules.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful