CSS overflow-inline Media Feature

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

What You’ll Learn

The overflow-inline media feature detects how a device handles content that overflows along the inline axis — usually horizontal scrolling in left-to-right languages.

01

@media

Media query.

02

scroll

Horizontal scroll.

03

Inline axis

Text direction.

04

vs block

Two axes.

05

Tables

Wide content.

06

Print

Paged output.

Introduction

Wide tables, long code lines, and horizontal carousels can extend beyond the viewport width. On screens, users typically scroll horizontally to reach that content. Printers may paginate instead.

The @media (overflow-inline) feature lets CSS detect how the device presents inline-axis overflow — not whether your page happens to overflow right now.

Definition and Usage

Wrap rules in @media (overflow-inline: scroll), @media (overflow-inline: paged), or the other accepted values. On laptops and phones, you will almost always match scroll.

💡
Beginner Tip

This is not the overflow CSS property and it does not use an auto value. It reports device capability along the inline axis, similar to overflow-block for the block axis.

📝 Syntax

Use a keyword value inside an @media rule:

syntax.css
@media (overflow-inline: scroll) {
  /* Styles for scrollable inline overflow */
}

@media (overflow-inline: paged) {
  /* Styles for paginated inline overflow */
}

Accepted Values

  • none — Overflow along the inline axis is not displayed.
  • scroll — Users can scroll horizontally 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).

Inline Axis vs Block Axis

Inline axis
Horizontal in English
overflow-inline
Block axis
Vertical in English
overflow-block

overflow-inline vs overflow Property

@media (overflow-inline: scroll) Device capability query — “Can users scroll inline-axis overflow on this output device?”
overflow-x: auto; Element styling — controls horizontal clipping and scrollbars on one box.

overflow-inline vs overflow-block

(overflow-inline: scroll) Inline-axis overflow — usually horizontal scrolling in horizontal writing modes.
(overflow-block: scroll) Block-axis overflow — usually vertical scrolling in horizontal writing modes.

Basic Example

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

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

Default Value

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

Syntax Rules

  • Use keyword values only: none, scroll, optional-paged, paged.
  • There is no auto value — the old reference was incorrect.
  • Inline axis follows writing-mode — vertical text uses a vertical inline axis.
  • Combine with overflow-block for axis-specific layouts.
  • Do not use this to detect whether a specific element currently overflows horizontally.

Related Topics

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

⚡ Quick Reference

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

When to Use overflow-inline

Reach for overflow-inline when horizontal overflow behavior matters:

  • Wide data tables — Style scrollable table wrappers when scroll matches.
  • Code blocks — Add horizontal scroll affordances on scroll-capable devices.
  • Carousels and toolbars — Adapt UI when inline-axis scrolling is available.
  • Print layouts — Adjust wide content for paginated inline overflow.
  • Writing modes — Handle inline axis correctly in vertical or mixed scripts.

👀 Live Preview

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

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

Examples Gallery

Practice overflow-inline with scroll backgrounds, wide tables, nowrap text styling, and block-axis comparisons.

📜 Core Patterns

Style pages based on inline-axis overflow behavior.

Example 1 — Background on scrollable devices

Apply a light coral background when the device supports scrolling along the inline axis:

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

How It Works

This is the classic beginner demo from the reference tutorial, corrected to use the proper scroll keyword instead of the nonexistent auto value.

Example 2 — Scrollable wide table wrapper

On scroll-capable inline overflow, style a table wrapper for horizontal scrolling:

overflow-inline-table.css
.table-wrap {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
}

@media (overflow-inline: scroll) {
  .table-wrap {
    border-color: #fca5a5;
    background: #fff5f5;
  }
}
Try It Yourself

How It Works

The media feature targets device capability; overflow-x: auto on the wrapper handles the actual horizontal scrolling.

Example 3 — Nowrap text on scroll devices

Highlight long single-line content when inline-axis scrolling is available (MDN pattern):

overflow-inline-nowrap.css
p {
  white-space: nowrap;
}

@media (overflow-inline: scroll) {
  p {
    color: #dc2626;
  }
}
Try It Yourself

How It Works

Adapted from the official MDN example. Red text signals that horizontal scrolling is the expected overflow behavior on this device.

Example 4 — overflow-inline vs overflow-block

Style inline-axis and block-axis scroll capabilities with different colors:

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

@media (overflow-inline: scroll) {
  .inline-axis {
    background: #fecaca;
    border-color: #fca5a5;
  }
}

@media (overflow-block: scroll) {
  .block-axis {
    background: #dbeafe;
    border-color: #93c5fd;
  }
}
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

  • Pair with overflow-x — Use the media feature for device-aware defaults; use overflow-x on wrappers for actual scrolling.
  • Assume scroll on screens — Most users browse on scroll-capable inline overflow devices.
  • Test print preview — Verify paged rules in the browser print dialog.
  • Use logical properties — Inline axis maps to inline-size and margin-inline in modern CSS.
  • Combine both overflow features — Handle vertical and horizontal device capabilities separately.

⚠️ Common Pitfalls

  • Using autooverflow-inline has no auto value; use scroll, paged, etc.
  • Confusing with overflow property — Media feature vs element styling are different tools.
  • Expecting content overflow detection — It reports device capability, not current overflow state.
  • Ignoring writing-mode — Inline axis direction changes in vertical writing systems.
  • Horizontal scroll without UX — Always provide scroll affordances for wide content.

♿ Accessibility

  • Keyboard horizontal scroll — Ensure wide regions are reachable with keyboard navigation.
  • Avoid nowrap everywhere — Long unbroken lines hurt readability; use nowrap sparingly.
  • Visible focus — Scrollable regions need clear focus indicators.
  • Touch scrolling — Wide tables should support touch drag on mobile.
  • Zoom support — Horizontal layouts must work when text is enlarged.

🧠 How overflow-inline Works

1

Browser evaluates output device

Checks how inline-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 tables, nowrap text, and axis-specific colors.

Apply
=

Axis-aware layout

CSS adapts to horizontal scroll screens and paginated print output.

🖥 Browser Compatibility

The overflow-inline media feature reached Baseline status in September 2023 alongside overflow-block.

Baseline · Since Sept 2023

Inline overflow queries

Chrome 113+, Firefox 66+, Safari 17+, Edge 113+.

92% Global support
overflow-inline media feature 92% supported

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

🎉 Conclusion

The overflow-inline media feature helps you tailor layouts for how devices handle horizontal (inline-axis) overflow. It complements overflow-block for complete axis-aware responsive design.

Use it for wide tables, code blocks, and carousels on scroll-capable screens. Pair with element-level overflow-x for the actual scrolling behavior.

💡 Best Practices

✅ Do

  • Use scroll keyword
  • Pair with overflow-x
  • Test print preview
  • Combine with overflow-block
  • Respect writing-mode

❌ Don’t

  • Use auto value
  • Confuse with overflow property
  • Detect element overflow
  • Force nowrap everywhere
  • Skip keyboard testing

Key Takeaways

Knowledge Unlocked

Five things to remember about overflow-inline

Use these points when styling horizontal overflow behavior.

5
Core concepts
I 02

Inline axis

Text direction.

Concept
B 03

overflow-block

Partner feature.

Related
X 04

overflow-x

Element scroll.

Property
! 05

No auto

Not a value.

Pitfall

❓ Frequently Asked Questions

What does the CSS overflow-inline media feature do?

The overflow-inline media feature reports how the output device handles content that overflows along the inline axis — the direction text flows in a line (usually horizontal in English). Values include scroll, paged, optional-paged, and none.

What values does overflow-inline accept?

Four keyword values: none (overflow is not displayed), scroll (users can scroll horizontally 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-inline different from overflow-block?

overflow-inline targets the inline axis (horizontal in left-to-right languages). overflow-block targets the block axis (usually vertical). Use both when horizontal and vertical overflow behavior differ on a device.

When should I use overflow-inline in CSS?

Use it to style wide tables and data grids on scroll-capable screens, add horizontal scroll hints, adapt carousels and toolbars, and pair with overflow-block for axis-specific layouts.

Is overflow-inline 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-inline: scroll) and wide table layouts.

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