MDN self-hosted library · e01.org

`inline-size` CSS property

The inline-size CSS property defines the size of an element's block along the inline axis. If the writing-mode is horizontal, it corresponds to the width; if the writing mode is vertical, it corresponds to the height. A related property is block-size, which defines the other dimension of the element.

no runnable cells css-property upstream source

The inline-size CSS property defines the size of an element's block along the inline axis. If the writing-mode is horizontal, it corresponds to the width; if the writing mode is vertical, it corresponds to the height. A related property is block-size, which defines the other dimension of the element.

CSS Demo: inline-size

```css interactive-example-choice inline-size: 150px; writing-mode: horizontal-tb;


```css interactive-example-choice
inline-size: 150px;
writing-mode: vertical-rl;

```css interactive-example-choice inline-size: auto; writing-mode: horizontal-tb;


```css interactive-example-choice
inline-size: auto;
writing-mode: vertical-lr;

```html interactive-example

This is a box where you can change the inline-size.

```css interactive-example
#example-element {
  display: flex;
  flex-direction: column;
  background-color: #5b6dcd;
  height: 80%;
  justify-content: center;
  color: white;
}

Syntax

/* <length> values */
inline-size: 300px;
inline-size: 25em;
inline-size: anchor-size(width);
inline-size: anchor-size(--my-anchor inline);

/* <percentage> values */
inline-size: 75%;

/* Keyword values */
inline-size: max-content;
inline-size: min-content;
inline-size: fit-content;
inline-size: fit-content(20em);
inline-size: auto;

/* Global values */
inline-size: inherit;
inline-size: initial;
inline-size: revert;
inline-size: revert-layer;
inline-size: unset;

Values

The inline-size property takes the same values as the width and height properties.

Formal definition

Formal syntax

Examples

Setting inline size in pixels

HTML

<p class="exampleText">Example text</p>

CSS

.exampleText {
  writing-mode: vertical-rl;
  background-color: yellow;
  inline-size: 110px;
}

Result

Setting_inline_size_in_pixels

Specifications

Browser compatibility

See also

  • The mapped physical properties: width and height
  • writing-mode