CSS Portal

CSS inline-size Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The inline-size CSS property defines an element’s size in the inline axis — the direction in which text and other inline content flow. Because it is a logical property, its effect depends on the element’s writing mode and direction rather than always mapping to the horizontal or vertical physical axes; for example, in typical horizontal text it behaves like width, while in vertical-rl flows its measurement runs top-to-bottom. The axis that counts as “inline” is determined by the element’s writing-mode, so switching writing modes lets the same declaration adapt gracefully to different text directions and scripts.

Using inline-size lets you express layout constraints in a way that’s neutral to the page’s orientation and language, which simplifies internationalization and reflow scenarios. Percentages on inline-size resolve against the containing block’s inline dimension, so when you reason about a percentage-based inline size you are effectively comparing with the parent’s inline measure (which itself might originate from a physical block-size or width declaration depending on writing mode). For replaced and intrinsically-sized elements, inline-size participates in the usual intrinsic sizing rules, interacting with aspect ratios and intrinsic widths or heights where applicable.

Practical layout control often combines inline-size with its constraint counterparts: min-inline-size and max-inline-size, which limit how small or large the inline extent may become during reflow. It also interacts with box model concerns such as box-sizing (which affects whether paddings and borders are included inside the declared inline measure) and with overflow handling via overflow. Because it is logical, using inline-size makes components more robust when used in multi-directional layouts, flexible containers, and responsive designs where writing mode or orientation may change.

Definition

Initial value
auto
Applies to
same as width and height
Inherited
no
Computed value
same as width and height
Animatable
a length, percentage or calc();
JavaScript syntax
object.style.inlineSize

Interactive Demo

Example of the inline-size property.

Syntax

inline-size: <width>

Values

  • <width&gThe inline-size property takes the same values as the width and height properties.

Example

<div class='wrapper'>
<h2>inline-size examples</h2>
<div class='row'>
<div class='box horizontal'>
This box uses inline-size: 40% (acts like width in horizontal writing mode).
</div>
<div class='box vertical'>
This box uses writing-mode: vertical-rl and inline-size: 8rem (acts like height in vertical writing mode).
</div>
</div>
</div>
.wrapper {
  inline-size: 48rem; /* sets the containing block's inline size (about 768px) */
  margin: 1.5rem auto;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.box {
  padding: 0.75rem 1rem;
  border: 2px solid #2b6cb0;
  background: #e6f2ff;
  color: #003366;
  border-radius: 6px;
  box-sizing: border-box;
}

.horizontal {
  inline-size: 40%;     /* in horizontal writing mode this sets the width */
  min-inline-size: 10rem;
}

.vertical {
  writing-mode: vertical-rl;
  inline-size: 8rem;    /* in vertical writing mode this sets the height */
  min-inline-size: 6rem;
}

h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
}

Browser Support

The following information will show you the current browser support for the CSS inline-size property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!