CSS inline-size Property
Example
Set the size of a <div> element in the inline direction:
div {
inline-size: 200px;
}
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The inline-size
property specifies the size of an element in the inline direction.
Note: The related CSS property writing-mode
defines inline direction, and this affects the result of the inline-size
property. For pages in English, inline direction is left to right and block direction is downward.
The CSS
inline-size
and
block-size
properties are very similar to CSS properties
width
and
height
, but the
inline-size
and
block-size
properties are dependent on inline and block directions.
Default value: | auto |
---|---|
Inherited: | no |
Animatable: | yes. Read about animatable Try it |
Version: | CSS3 |
JavaScript syntax: | object.style.inlineSize="250px" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
inline-size | 57.0 | 79.0 | 41.0 | 12.1 | 44.0 |
CSS Syntax
inline-size: auto|value|initial|inherit;
Property Values
Value | Description | Demo |
---|---|---|
auto | Default. The element's default inline-size value. | Demo ❯ |
length | Specifies the inline-size in px, pt, cm, etc. Negative values are allowed. Read about length units | Demo ❯ |
% | Specifies the inline-size in percent relative to size of parent element on the corresponding axis. | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
More Examples
Example
With the writing-mode
property value of a <div> element set to vertical-rl, the inline direction is changed from sideways to downwards, and this affect how the inlie-size
property work:
div {
inline-size: 250px;
writing-mode: vertical-rl;
}
Try it Yourself »
Related Pages
CSS tutorial: CSS Height and Width
CSS tutorial: CSS Box model
CSS reference: height property
CSS reference: width property
CSS reference: writing-mode property