CSS max-inline-size Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The max-inline-size property sets a maximum size on the inline axis. In the default horizontal writing mode it behaves like max-width. In a vertical writing mode it behaves like max-height.

The box can stay smaller than the limit. It cannot grow past the ceiling on that axis. Pair it with inline-size and min-inline-size for full logical sizing. The other axis uses max-block-size.

Standard-track.

Not deprecated. Part of CSS Logical Properties. Length, percentage, and none are Baseline. Intrinsic keywords are widely supported; stretch is newer and limited.

Limited support stretch

The stretch keyword for max-inline-size is not ready for everyday use. Prefer lengths, percentages, or none.

CSS Syntax

syntax.css
max-inline-size: none | <length> | <percentage> | min-content | max-content | fit-content | initial | inherit;

Values match max-width / max-height. Start with none, lengths, and percentages.

Property Values

ValueDescriptionTry it
noneDefault. No maximum on the inline axisTry it
<length>Fixed ceiling such as 20rem, 300px, or 40chTry it
<percentage>Percent of the containing block’s inline sizeTry it
initialResets to noneTry it
inheritTakes the parent’s max-inline-sizeTry it

How to Use max-inline-size

Cap the inline axis, then remember that writing mode decides which physical side that is.

  1. Leave max-inline-size: none when the box should grow freely inline.
  2. Set a length or percentage to cap growth (great for readable line lengths).
  3. Know your writing-mode: horizontal maps to width; vertical maps to height.
  4. Use max-width only when you specifically need a physical horizontal ceiling.
PieceRequired?Role
Element that accepts sizeYesSame rules as width / height
max-inline-size valueYesnone, length, percentage, or keyword
writing-modeContextChooses whether the cap is width or height
Containing block sizeFor %Percentage resolves against the parent’s inline size

Live Preview

Same paragraph, different max-inline-size values. In horizontal writing, the box stops growing wider.

Default writing mode is horizontal, so this ceiling acts like max-width.

Box
This text grows along the inline axis until it hits the max-inline-size ceiling you set.

max-inline-size: 12rem

CSS Examples

Each snippet focuses on max-inline-size. Use Try It Yourself for a live editor.

Example 1 — Readable Length Cap

Stop a paragraph from stretching too wide on large screens.

CSS
<style>
  p {
    max-inline-size: 20rem;
  }
</style>

<p>This paragraph will not grow wider than 20rem.</p>
Try It Yourself

How It Works

  1. Set a ceiling. 20rem is the maximum inline size.
  2. Horizontal writing. With default writing-mode, that ceiling is a max width.
  3. Short content stays short. The box can be narrower than 20rem.
  4. Long lines wrap. Extra text wraps inside the capped width instead of stretching the box.

Example 2 — Vertical Writing Mode

In vertical text, the same property caps height, not width.

CSS
<style>
  p {
    writing-mode: vertical-rl;
    max-inline-size: 8rem;
  }
</style>

<p>Inline axis is vertical here.</p>
Try It Yourself

How It Works

  1. Flip the axis. writing-mode: vertical-rl makes lines run top to bottom.
  2. Inline becomes vertical. So max-inline-size now maps to max-height.
  3. Same property name. You did not switch to max-height; the logical name followed the writing mode.
  4. Why it matters. One rule can work for horizontal and vertical layouts without rewriting physical sizes.

Example 3 — No Cap vs Cap

Compare free growth with a hard ceiling on the same text.

CSS
<style>
  .free {
    max-inline-size: none;
  }

  .capped {
    max-inline-size: 12rem;
  }
</style>

<p class="free">Grows with the container.</p>
<p class="capped">Stops at 12rem on the inline axis.</p>
Try It Yourself

How It Works

  1. Leave the default. none means no inline ceiling.
  2. Add a ceiling. 12rem stops growth along the inline axis.
  3. Text still wraps. The capped box wraps words instead of becoming wider.
  4. Logical twin of max-width. In horizontal writing these two look the same; they diverge when writing mode changes.

Edge Cases & Pitfalls

Most confusion comes from mixing logical and physical size properties.

axis

Writing mode changes the mapped side

Horizontal: acts like max-width. Vertical: acts like max-height. Check writing-mode before debugging.

physical

Do not mix casually with max-width

Setting both can fight. Pick logical sizing for portable layouts, or physical sizing when you truly mean horizontal only.

percent

Percentage uses the parent’s inline size

50% is half of the containing block’s inline size. In vertical writing that parent size is height-oriented.

ie

Internet Explorer has no support

IE never shipped logical sizing. Use max-width as a fallback only if you still need that browser.

pair

Remember the block-axis twin

Cap the other dimension with max-block-size. Together they replace max-width + max-height in logical layouts.

Browser Support

max-inline-size is a browser layout property. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

max-inline-size

Chrome 57+, Firefox 41+, Safari 12.1+, Edge 79+. Internet Explorer has no support. Intrinsic keywords are widely supported; stretch is limited.

97% Common values
Google Chrome 57+
Full
Mozilla Firefox 41+
Full
Apple Safari 12.1+
Full
Microsoft Edge 79+
Full
Opera 44+
Full
Samsung Internet 7+
Full
Internet Explorer No support
None
max-inline-size Widely supported

Bottom line: Safe for modern sites. Fall back to max-width only if you must support Internet Explorer. Treat stretch as progressive enhancement.

Key Takeaways

  • Role: set a ceiling on the inline axis, following writing mode.
  • Maps to: max-width (horizontal) or max-height (vertical).
  • Initial value: none. Not inherited.
  • Best use: readable columns and writing-mode-aware components.

One line: max-inline-size is a logical ceiling — width in horizontal writing, height in vertical writing.

Frequently Asked Questions

It sets a maximum size on the inline axis. In horizontal writing that usually caps width. In vertical writing it caps height instead.
The initial value is none, which means there is no maximum on the inline axis. The element can grow with its content and container.
max-width always limits horizontal size. max-inline-size follows writing-mode: it maps to max-width in horizontal-tb and to max-height in vertical writing modes.
Use it for readable text columns, cards, and components that should stay portable across writing modes. Prefer max-width only when you truly mean physical horizontal size.
No. Use max-width as a fallback if you must support IE. Modern Chromium Edge, Firefox, Safari, and Chrome all support it.
It is Baseline and widely available: Chrome 57+, Firefox 41+, Safari 12.1+, Edge 79+. It is a browser layout property, not a Node.js feature.

Next: max-width

Learn the physical horizontal maximum size property.

max-width tutorial →

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.

8 people found this page helpful