CSS inline-size Property

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

Definition and Usage

The inline-size property sets the size of an element along the inline axis. In a horizontal writing mode it behaves like width. In a vertical writing mode it behaves like height.

It is not inherited. The initial value is auto. Pair it with block-size for the other axis, and with writing-mode when text direction changes.

Logical property.

Prefer inline-size over width when a layout must stay correct for both horizontal and vertical writing modes.

CSS Syntax

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

Values match width / height. Newer keywords like stretch have limited support.

Property Values

ValueDescriptionTry it
autoDefault. Browser sizes the box from contentTry it
<length>Fixed size such as 200px, 12rem, or 40vwTry it
<percentage>Percent of the containing block’s inline sizeTry it
with writing-modeIn vertical mode, inline-size maps to physical heightTry it
initialResets to autoTry it
inheritTakes the parent’s inline-sizeTry it

How to Use inline-size

Think in writing-mode terms: size the inline axis, not “always left–right.”

  1. Use inline-size where you would reach for width in a horizontal layout.
  2. Pick auto, a length, or a percentage of the containing block.
  3. Add min-inline-size / max-inline-size when you need floors or caps.
  4. Test with writing-mode if the page may switch to vertical text.
PieceRequired?Role
Block or sized boxYesSame applicability rules as width
inline-size valueYesauto, length, percentage, or keyword
Containing block sizeFor %Percentage uses the parent’s inline size
writing-modeOptionalChooses whether inline maps to width or height

Live Preview

Change inline-size on the sample box. In the default horizontal mode, this acts like width.

The outer frame is 320px wide so 50% has a parent inline size to resolve against.

Box
Box

inline-size: 200px

CSS Examples

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

Example 1 — Fixed Length

Set an exact inline size. In horizontal mode this is like width.

CSS
<style>
  div {
    inline-size: 200px;
  }
</style>

<div>200px inline</div>
Try It Yourself

How It Works

  1. Pick a length. 200px sets the inline-axis size.
  2. Horizontal mode. With default writing mode, that size is the physical width.
  3. Content may wrap. Text wraps inside the fixed inline size.
  4. Other units work. Try rem, em, or vw the same way.

Example 2 — Percentage of Parent

Size a child as half of the parent’s inline size.

CSS
<style>
  .parent {
    inline-size: 320px;
  }

  .child {
    inline-size: 50%;
  }
</style>

<div class="parent">
  <div class="child">Half of parent</div>
</div>
Try It Yourself

How It Works

  1. Give the parent an inline size. 320px defines the containing block.
  2. Use a percentage on the child. 50% resolves to 160px here.
  3. Axis matters. The percent uses the parent’s inline size, not block size.
  4. Same idea as width %. In horizontal mode the math matches width: 50%.

Example 3 — Vertical Writing Mode

With vertical text, inline-size maps to physical height.

CSS
<style>
  div {
    writing-mode: vertical-rl;
    inline-size: 120px;
  }
</style>

<div>Inline axis</div>
Try It Yourself

How It Works

  1. Set vertical writing. writing-mode: vertical-rl rotates the axes.
  2. Inline becomes vertical. Text flows top-to-bottom; the inline axis is now vertical.
  3. inline-size follows. 120px controls physical height, not width.
  4. Why logical wins. One rule keeps sizing correct when writing mode changes.

Edge Cases & Pitfalls

Most confusion comes from mixing logical and physical sizing.

map

Not always the same as width

In vertical writing modes, inline-size maps to height. Do not assume it always means left–right size.

conflict

Mixing with width can conflict

Setting both width and inline-size on the same element can produce unexpected results. Prefer one system.

percent

Percentage uses inline containing size

Percentages resolve against the containing block’s inline size. In vertical mode that parent measure is physical height.

limits

min- / max-inline-size override

Those properties can stop a box from shrinking or growing past a limit, just like min-width / max-width.

box

box-sizing still applies

With border-box, padding and border count inside the size. With content-box, they add outside it.

Browser Support

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

✓ Baseline · Widely available

inline-size

Widely available across modern browsers since ~2020. Same value set as width/height; stretch remains limited.

96% 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.0+
Full
Internet Explorer No
None
inline-size Widely supported

Bottom line: Safe for modern sites. Prefer logical sizing when writing-mode flexibility matters. Skip Internet Explorer.

Key Takeaways

  • Role: size the inline axis — width in horizontal mode, height in vertical mode.
  • Common values: auto, lengths, and percentages (same as width).
  • Initial value: auto. Not inherited.
  • Tip: use with block-size for fully logical box sizing.

One line: inline-size is the logical version of width — it follows the writing mode’s inline axis.

Frequently Asked Questions

It sets the size of an element along the inline axis. In horizontal writing modes it maps to width; in vertical writing modes it maps to height.
The initial value is auto. The browser sizes the box from content and layout rules.
width always controls the horizontal size. inline-size follows writing-mode, so it adapts when text runs vertically.
Use it when you want logical sizing that stays correct across horizontal and vertical writing modes.
No. Percentages resolve against the inline size of the containing block.
It is Baseline and widely available across modern browsers since about 2020. It is a browser layout property, not a Node.js feature.

Next: inset

Learn the shorthand for top, right, bottom, and left offsets.

inset 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