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.
Fundamentals
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.
Foundation
📝 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.
On most screens both features match scroll. The distinction matters when one axis paginates and the other scrolls.
Tips
🛠 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.
Watch Out
⚠️ Common Pitfalls
Using auto — overflow-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.
A11y
♿ 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.
Compatibility
🖥 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 feature92% supported
Bottom line: Safe for progressive enhancement today. Provide fallbacks for Safari 16 and older Chromium builds.
Wrap Up
🎉 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.
Use these points when styling horizontal overflow behavior.
5
Core concepts
S01
scroll
Typical screens.
Value
I02
Inline axis
Text direction.
Concept
B03
overflow-block
Partner feature.
Related
X04
overflow-x
Element scroll.
Property
!05
No auto
Not a value.
Pitfall
FAQ
❓ 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.