CSS overflow-inline Property

The CSS overflow-inline property controls how overflowing content is displayed along an element's logical inline axis.

The inline axis follows the element's writing mode. It is horizontal in conventional horizontal writing and vertical in vertical writing modes. This property provides a writing-mode-aware alternative to the physical overflow-x and overflow-y properties.

overflow-inline Syntax

The overflow-inline property accepts one overflow keyword that determines how content extending beyond the inline axis is handled.

Basic Syntax

selector {
  overflow-inline: auto;
}

Keyword Values

.box {
  overflow-inline: visible;
}
.box {
  overflow-inline: hidden;
}
.box {
  overflow-inline: clip;
}
.box {
  overflow-inline: scroll;
}
.box {
  overflow-inline: auto;
}

CSS-Wide Keywords

.box {
  overflow-inline: initial;
}
.box {
  overflow-inline: inherit;
}
.box {
  overflow-inline: unset;
}
.box {
  overflow-inline: revert;
}
.box {
  overflow-inline: revert-layer;
}

The initial value is visible, allowing content to extend beyond the element's padding box when the other overflow axis does not cause a computed value adjustment.

Property Values

Value Description
visible Allows content to extend beyond the padding box along the inline axis. This is the initial value.
hidden Clips overflowing content without providing user-operated scrolling along the affected axis. Programmatic scrolling remains possible.
clip Clips overflowing content at the overflow clip edge without permitting scrolling along the clipped axis.
scroll Clips overflowing content and enables scrolling along the inline axis.
auto Allows the browser to provide scrolling when content exceeds the available space along the inline axis.
initial Resets the property to visible.
inherit Uses the computed value of the parent element.
unset Resets the property to visible because the property is not inherited.
revert Reverts the property according to cascade origin rules.
revert-layer Reverts the property according to cascade layer rules.

Property Characteristics

Characteristic Value
Initial value visible
Inherited No
Applies to Block containers, flex containers, and grid containers
Computed value Specified keyword, with adjustments based on overflow along the other axis
Animation type Discrete
Logical axis Inline axis
Physical equivalent overflow-x or overflow-y, depending on writing mode

Valid Values

.box {
  overflow-inline: visible;
}
.box {
  overflow-inline: hidden;
}
.box {
  overflow-inline: clip;
}
.box {
  overflow-inline: scroll;
}
.box {
  overflow-inline: auto;
}

Invalid Values

.box {
  overflow-inline: none;
}
.box {
  overflow-inline: 20px;
}
.box {
  overflow-inline: hidden auto;
}

The property accepts one overflow keyword, not a length or a pair of overflow values.

How It Works

The overflow-inline property controls what happens when content exceeds an element's available space along its logical inline axis.

Scrollable Inline Content

.content-panel {
  inline-size: 250px;
  overflow-inline: auto;
}

When content exceeds the available inline size, the browser can provide scrolling along that axis.

Clipping Inline Content

.content-panel {
  inline-size: 250px;
  overflow-inline: hidden;
}

Content extending beyond the inline-axis boundary is clipped.

Allowing Visible Overflow

.content-panel {
  inline-size: 250px;
  overflow-inline: visible;
}

Overflowing content remains visible when the overflow setting on the block axis permits it.

Important Consideration

Setting overflow-inline: auto does not guarantee that scrolling will occur. Content must actually overflow the available inline dimension.

Understanding the Inline Axis

CSS logical properties use the inline and block axes instead of fixed horizontal and vertical directions.

Inline Axis

The inline axis follows the direction in which text progresses within a line. In conventional horizontal writing, the inline axis is horizontal.

Block Axis

The block axis is perpendicular to the inline axis and follows the direction in which lines or blocks are stacked.

Horizontal Writing Mode

.box {
  writing-mode: horizontal-tb;
  overflow-inline: auto;
}

The inline axis is horizontal, so overflow-inline corresponds to overflow-x.

Vertical Writing Mode

.box {
  writing-mode: vertical-rl;
  overflow-inline: auto;
}

The inline axis is vertical, so overflow-inline corresponds to overflow-y.

Text Direction

The direction property can reverse the direction of inline progression without changing the physical axis. For example, both left-to-right and right-to-left horizontal text use a horizontal inline axis.

Overflow Values

The five overflow keywords determine whether overflowing content remains visible, is clipped, or can be scrolled.

visible

.box {
  overflow-inline: visible;
}

Allows content to extend beyond the inline boundary. This is the default behavior unless the other overflow axis causes the value to compute differently.

hidden

.box {
  overflow-inline: hidden;
}

Clips overflowing content while allowing programmatic scrolling along the affected axis.

clip

.box {
  overflow-inline: clip;
}

Clips overflowing content without creating a scroll container by itself. Programmatic scrolling is not permitted along the clipped axis.

scroll

.box {
  overflow-inline: scroll;
}

Enables scrolling along the inline axis. Scrollbar visibility depends on the browser and operating system.

auto

.box {
  overflow-inline: auto;
}

Enables scrolling when the content exceeds the available inline space.

Choosing a Value

Use auto for content that should remain accessible through scrolling, visible when overflow should remain visible, and clipping values only when hiding the excess content is intentional.

Writing Modes

The physical direction controlled by overflow-inline depends on the element's writing-mode value.

Writing Mode Inline Axis Physical Equivalent
horizontal-tb Horizontal overflow-x
vertical-rl Vertical overflow-y
vertical-lr Vertical overflow-y
sideways-rl Vertical overflow-y
sideways-lr Vertical overflow-y

Horizontal Writing

.box {
  writing-mode: horizontal-tb;
  inline-size: 250px;
  overflow-inline: auto;
}

Vertical Writing

.box {
  writing-mode: vertical-rl;
  inline-size: 250px;
  overflow-inline: auto;
}

Writing-Mode-Aware Components

Logical overflow properties are useful for components that may be displayed in different writing modes. The same declaration continues to target the inline axis without requiring separate horizontal and vertical rules.

Important Consideration

Changing the writing mode can also affect dimensions, text flow, and the position of scrollbars. Test the complete component rather than only the overflow declaration.

Logical vs. Physical Overflow

Physical overflow properties control fixed axes. Logical overflow properties adapt to the writing mode.

Property Axis Writing-Mode-Aware
overflow-x Physical horizontal No
overflow-y Physical vertical No
overflow-inline Logical inline Yes
overflow-block Logical block Yes

Physical Overflow Example

.box {
  overflow-x: auto;
}

This always controls horizontal overflow, regardless of writing mode.

Logical Overflow Example

.box {
  overflow-inline: auto;
}

This controls horizontal overflow in horizontal writing modes and vertical overflow in vertical writing modes.

Fallback for Horizontal Writing

.box {
  writing-mode: horizontal-tb;
  overflow-x: auto;
  overflow-inline: auto;
}

Browsers that do not support overflow-inline can use the physical overflow-x declaration.

Important Consideration

A physical fallback must match the intended writing mode. For vertical writing, overflow-y is the equivalent fallback.

overflow-inline and overflow-block

The overflow-inline and overflow-block properties control overflow along perpendicular logical axes.

Inline-Axis Scrolling

.box {
  overflow-inline: auto;
  overflow-block: hidden;
}

Block-Axis Scrolling

.box {
  overflow-inline: hidden;
  overflow-block: auto;
}

Scrolling Along Both Axes

.box {
  overflow-inline: auto;
  overflow-block: auto;
}

Clipping Along Both Axes

.box {
  overflow-inline: clip;
  overflow-block: clip;
}

When both axes use clip, the element does not become a scroll container because of those declarations.

Important Consideration

Logical overflow properties map to the same underlying axes as physical overflow properties. If both forms target the same axis, normal CSS cascade rules determine which declaration wins.

Computed Value Adjustments

Overflow values on the two axes interact. Some specified values are adjusted when the other axis uses a scrolling overflow value.

visible with auto

.box {
  overflow-inline: visible;
  overflow-block: auto;
}

The specified visible value computes to auto because the other axis uses auto.

clip with scroll

.box {
  overflow-inline: clip;
  overflow-block: scroll;
}

The specified clip value computes to hidden because the other axis uses scroll.

Both Axes Using visible

.box {
  overflow-inline: visible;
  overflow-block: visible;
}

Both values remain visible.

Both Axes Using clip

.box {
  overflow-inline: clip;
  overflow-block: clip;
}

Both values remain clip.

Important Consideration

These adjustments are part of the CSS overflow rules. They are not specific to logical properties and also apply to overflow-x and overflow-y.

Scroll Containers

A scroll container allows users to move through content that exceeds its available space along a scrollable axis.

Creating Inline Overflow

.scroll-panel {
  inline-size: 250px;
  overflow-inline: auto;
}
.scroll-panel .wide-content {
  inline-size: 500px;
}

In horizontal writing mode, the child is wider than the container and can produce horizontal scrolling.

Using Logical Sizing

.scroll-panel {
  inline-size: 300px;
  block-size: 180px;
  overflow-inline: auto;
}

The logical dimensions adapt to the writing mode along with the overflow property.

Scrollbar Gutter

.scroll-panel {
  inline-size: 300px;
  overflow-inline: auto;
  scrollbar-gutter: stable;
}

The scrollbar-gutter property can reserve space for classic scrollbars when applicable.

Scroll Behavior

.scroll-panel {
  overflow-inline: auto;
  scroll-behavior: smooth;
}

The scroll-behavior property controls certain programmatic scrolling operations, not ordinary manual scrolling.

Important Consideration

Ensure that overflowing content remains reachable using the intended input methods. Avoid nested scroll regions unless they are necessary for the interface.

overflow-inline Example

This example demonstrates how the logical inline axis changes between horizontal and vertical writing modes. Both panels use overflow-inline: auto.

HTML Example

<div class="inline-demo">
  <div class="inline-demo-item">
    <h3>Horizontal Writing</h3>
    <div class="inline-demo-box inline-horizontal" tabindex="0">
      <div class="inline-demo-content">
        <span>Item 1</span>
        <span>Item 2</span>
        <span>Item 3</span>
        <span>Item 4</span>
      </div>
    </div>
  </div>
  <div class="inline-demo-item">
    <h3>Vertical Writing</h3>
    <div class="inline-demo-box inline-vertical" tabindex="0">
      <div class="inline-demo-content">
        <span>Item 1</span>
        <span>Item 2</span>
        <span>Item 3</span>
        <span>Item 4</span>
      </div>
    </div>
  </div>
</div>

CSS Example

.inline-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 20px;
  background-color: #f1f5f9;
}
.inline-demo-item {
  width: 250px;
}
.inline-demo-item h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.inline-demo-box {
  box-sizing: border-box;
  width: 250px;
  height: 150px;
  padding: 12px;
  border: 2px solid #64748b;
  background-color: #fff;
  overflow-inline: auto;
}
.inline-demo-content {
  display: flex;
  gap: 10px;
}
.inline-demo-content span {
  flex: none;
  padding: 12px;
  background-color: #dbeafe;
  border: 1px solid #93c5fd;
}
.inline-horizontal {
  writing-mode: horizontal-tb;
}
.inline-horizontal .inline-demo-content {
  width: max-content;
}
.inline-vertical {
  writing-mode: vertical-rl;
}
.inline-vertical .inline-demo-content {
  height: max-content;
}
Browser Result

Horizontal Writing

Item 1 Item 2 Item 3 Item 4

Vertical Writing

Item 1 Item 2 Item 3 Item 4

In horizontal writing mode, the items extend along the horizontal inline axis. In vertical writing mode, they extend along the vertical inline axis. Scroll within either panel to view the overflowing items.

The Browser Result includes physical overflow fallbacks for browsers that do not support overflow-inline. The example therefore remains usable even when the logical property is unavailable.

Comparing Overflow Values

The following example compares visible, hidden, and auto in horizontal writing mode.

<div class="inline-values">
  <div class="inline-value-box inline-visible">
    <span>A</span><span>B</span><span>C</span><span>D</span>
  </div>
  <div class="inline-value-box inline-hidden">
    <span>A</span><span>B</span><span>C</span><span>D</span>
  </div>
  <div class="inline-value-box inline-auto">
    <span>A</span><span>B</span><span>C</span><span>D</span>
  </div>
</div>
.inline-values {
  display: flex;
  flex-wrap: wrap;
  gap: 60px;
  padding: 20px;
}
.inline-value-box {
  display: flex;
  flex-wrap: nowrap;
  width: 120px;
  padding: 8px;
  border: 2px solid #64748b;
  background-color: #f8fafc;
}
.inline-value-box span {
  flex: none;
  padding: 10px;
  background-color: #dbeafe;
  border: 1px solid #93c5fd;
}
.inline-visible {
  overflow-inline: visible;
}
.inline-hidden {
  overflow-inline: hidden;
}
.inline-auto {
  overflow-inline: auto;
}
Browser Result
ABCD
ABCD
ABCD

The first box allows its items to extend beyond the boundary. The second clips the excess content, while the third provides scrolling when needed.

Accessibility Considerations

Overflow settings should preserve access to content and remain usable with different input methods and writing modes.

Keyboard-Accessible Scroll Regions

<div class="scroll-region" tabindex="0" role="region" aria-label="Scrollable items">
  <div class="scroll-content">Scrollable content</div>
</div>
.scroll-region {
  inline-size: 250px;
  overflow-inline: auto;
}
.scroll-region:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

A focusable scroll region can help keyboard users reach its content when the browser does not otherwise provide convenient keyboard scrolling.

Avoid Clipping Essential Content

Using hidden or clip may conceal links, buttons, or information that users need.

Preserve Focus Indicators

Check that focused controls remain visible within scrollable or clipped regions.

Test Zoom and Narrow Viewports

Content may overflow differently when users increase text size or browser zoom. Verify that scrolling remains possible when needed.

Important Consideration

Use auto rather than clipping when users must be able to reach content that extends beyond the container.

Common Mistakes

Assuming the Inline Axis Is Always Horizontal

.box {
  writing-mode: vertical-rl;
  overflow-inline: auto;
}

In vertical writing modes, the inline axis is vertical.

Expecting Overflow Without Constrained Space

If the content fits or the container expands to accommodate it, no scrolling may be necessary.

Using Multiple Overflow Values

.box {
  overflow-inline: hidden auto;
}

The property accepts only one overflow value.

Using Invalid Keywords

.box {
  overflow-inline: none;
}

The none keyword is not valid for this property.

Confusing hidden and clip

hidden permits programmatic scrolling, while clip prevents scrolling along the clipped axis.

Ignoring Computed Value Adjustments

A specified visible or clip value may compute differently when the other axis uses a scrolling overflow value.

Conflicting Logical and Physical Declarations

.box {
  overflow-x: hidden;
  overflow-inline: auto;
}

In horizontal writing mode, these declarations target the same axis. The cascade determines which value takes precedence.

Assuming Universal Browser Support

Some browsers do not recognize overflow-inline. Provide appropriate physical overflow fallbacks when necessary.

Important Considerations

Keep the following points in mind when using overflow-inline:

  • The property controls overflow along the logical inline axis.
  • Its initial value is visible.
  • The property is not inherited.
  • It accepts visible, hidden, clip, scroll, and auto.
  • Only one overflow value is permitted.
  • The inline axis depends on the element's writing mode.
  • In horizontal writing, the inline axis is horizontal.
  • In vertical writing, the inline axis is vertical.
  • The property corresponds to overflow-x or overflow-y, depending on writing mode.
  • visible allows content to extend beyond the container.
  • hidden clips content while permitting programmatic scrolling.
  • clip clips content without allowing scrolling along that axis.
  • scroll enables scrolling along the inline axis.
  • auto enables scrolling when needed.
  • Scrolling requires content to exceed the available space.
  • Overflow values on the two axes can affect one another's computed values.
  • overflow-block controls overflow along the logical block axis.
  • Logical and physical overflow declarations may target the same underlying axis.
  • Clipping can conceal content and focus indicators.
  • Scrollbar presentation depends on the browser and operating system.
  • Logical overflow properties are useful for multilingual and writing-mode-aware layouts.
  • Browser support is less consistent than for physical overflow properties.
  • Use physical fallbacks when broad compatibility is required.
  • Test scrolling with keyboard, touch, and other intended input methods.

Browser Support

The CSS overflow-inline property has Limited availability and is not supported consistently across all major browsers.

The physical overflow-x and overflow-y properties have broader support. Browsers that do not recognize overflow-inline ignore the declaration.

Fallback Example

.horizontal-panel {
  writing-mode: horizontal-tb;
  overflow-x: auto;
  overflow-inline: auto;
}
.vertical-panel {
  writing-mode: vertical-rl;
  overflow-y: auto;
  overflow-inline: auto;
}

The physical declarations provide fallback behavior for each writing mode. The logical declarations are placed afterward so they can take precedence in supporting browsers.

For current compatibility information, visit Can I Use? and search for overflow-inline.

Specifications

The overflow-inline property is defined in CSS Overflow Module Level 3.

CSS Overflow Module Level 3: Overflow Control

The specification defines the logical overflow properties and their relationship to the physical overflow axes.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: overflow-inline