CSS inline-size egenskab

Definition and usage

inline-size The attribute specifies the size of the element in the inline direction.

Note:Related CSS properties writing-mode It defines the inline direction, which affects inline-size The result of the attribute. For English pages, the inline direction is from left to right, and the block direction is downward.

CSS's inline-size and block-size The attribute is similar to CSS's width and height The attribute is very similar to, but inline-size and block-size The attribute depends on the inline and block directions.

Example

Example 1

Set the size of the <div> element in the inline direction:

div {
  inline-size: 200px;
}

Try it yourself

Example 2

when the writing-mode The attribute value is set to vertical-rl when, the inline direction changes from horizontal to vertical downward, which affects inline-size How the attribute works:

div {
  inline-size: 250px;
  writing-mode: vertical-rl;
}

Try it yourself

CSS syntax

inline-size: auto|length|initial|inherit;

Attribute value

Value Description
auto Default value. The default inline-size value of the element.
length

Specifies the size of the inline direction, with units such as px, pt, cm, etc.

Negative values are allowed. See:CSS units.

% Specifies a percentage of the size relative to the parent element on the corresponding axis.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: auto
Inheritance: No
Animation creation: Supported. See:Animation-related properties.
Version: CSS3
JavaScript syntax: object.style.inlineSize="250px"

Browser support

The numbers in the table indicate the first browser version to fully support this attribute.

Chrome Edge Firefox Safari Opera
57.0 79.0 41.0 12.1 44.0

Related pages

CSS Tutorial:CSS højde og bredde

CSS Tutorial:CSS rammemodel

CSS Reference:Height attribute

CSS Reference:Width attribute

CSS Reference:writing-mode egenskab