Inset-block, inset-inline, etc. CSS properties.

And the logical properties:
- inset-block-start
For a positioned element, sets the location of the edge on the start side of the block.
- inset-block-end
For a positioned element, sets the location of the end side of the block.
- inset-inline
Defines the position of a positioned element in the inline direction. Shorthand for inset-inline-start and inset-inline-end.
- inset-inline-start
On a positioned element, sets the location of the edge at the starting of the line.
- inset-inline-end
On a positioned element, sets the location of the edge at the end of the line.
inset-block
inset-inline

Summary of characteristics of the inset-block property

Quick description
Defines the position of a positioned element in the block direction. Shorthand for inset-block-start and inset-block-end.
Status
Standard
Applies to
Positioned elements.
Usable for
HTML
Predefined values
auto
Percentages
Calculated relative to the dimension of the parent element in the block direction.
Initial value
auto
Inherited by default
No.
Computed value: during an animation, the inset-block property gradually changes from one value to another.
Per grammar: serialization in the order of syntax.
W3C Module
CSS Positioned Layout Module
 🡇  
 🡅  
Document status: WD (Working Draft)

Document status: WD (Working Draft)

Syntax diagram of inset-block.

Inset-block property - Syntax diagramSyntax diagram of the inset-block CSS property. See stylescss.free.fr for details. auto auto length | % length | % {1,2} {1,2}inset-block:;inset-block:;
Syntactic scheme of the property
inset-block
Inset-inline property - Syntax diagramSyntax diagram of the inset-inline CSS property. See stylescss.free.fr for details. auto auto length | % length | % {1,2} {1,2}inset-inline:;inset-inline:;
Syntactic scheme of the property
inset-inline

In the diagram, the bold terms are the predefined words of CSS, the other terms are described below:

  • length is a numeric value followed by one of CSS dimension units.
  • % is a percentage calculated relative to the corresponding dimension of the parent element.

Description of inset-block and inset-inline properties.

The properties inset-block and inset-inline define the location of a non-static element (whose position property is not set to static), or more precisely the location of one of the edges of the element.

The two properties inset-block and inset-inline are short-hand for the following four properties:

Short-hand propertiesIndividual properties
inset-blockinset-block-start
inset-block-end
inset-inlineinset-inline-start
inset-inline-end

These four individual properties are therefore equivalent to the properties top, right, bottom, and left, except that they depend on the writing direction and writing mode (see explanations on writing modes (Writing Mode) here: writing modes).

The inset... properties affect positioned elements, that is, those for which the property position has one of the values absolute, fixed, relative, or sticky. They have no effect on non-positioned elements, that is, elements for which the property position has its initial value or static. Refer to the position property for more details on element positioning.

Conflicts may arise: for example, it may be impossible to set the distance from the right edge and from the left edge at the same time. To resolve these conflicts, the element can be resized if its dimensions are not specified or are set to auto. However, if the element's dimensions are defined, the values on the end side are ignored.

Here is an illustration with the property inset-inline. The mechanism is identical for inset-block.

Conflict with the property inset-inline
width:auto;
inset-inline:100px 100px;

The element is resized to satisfy 100 pixels on each side.
Conflict with the property inset-inline
width:400px;
inset-inline:100px 100px;

The value of the end side is ignored.

Language support.

inset-block and inset-inline are logical properties, that is to say they take into account the direction and the writing sense. For example, Latin languages are written from left to right, then from top to bottom. The diagram below shows the influence of the language on these properties.

top
left
The direction and writing mode of this text adapt to the chosen language.
right
bottom

You can also consult a general presentation on writing modes depending on the languages.

Syntaxes for inset-block and inset-inline.

  • inset-block: auto; inset-inline: auto;

    The position of the element is determined by the browser. It is generally the position that the element would have had in a static state.

  • inset-block: 120px 100px; a b

    One to two values separated by a space, followed by a dimension unit (see CSS dimension units). Percentages are calculated relative to the corresponding dimension of the parent element.

    These two values act along the block axis (vertically for Latin languages). If only one value is specified, it applies identically to the beginning and end of the block.

    inset-block property with a single value
    Single value
    It applies to both edges (start of block and end of block).
    inset-block property with two values
    Two values
    The first applies to the edge that is the start of the block, and the second to the edge that is the end of the block.

    The syntax of our example is equivalent to: inset-block-start: 120px; inset-block-end: 100px;

    Let us recall that if the size of the element in the block direction is not specified or is set to auto, the element can be resized to satisfy the values of inset-block. On the other hand, if the size of the element is defined, the second value of inset-block is ignored.

  • inset-inline: 120px 100px; a b

    One or two values separated by a space, followed by a dimension unit (see CSS dimension units). Percentages are calculated relative to the corresponding dimension of the parent element.

    These two values act along the line axis (horizontal direction for Latin languages). If only one value is specified, it applies to the edge at the start of the lines and the edge at the end of the lines.

    inset-inline with a single value
    Only one value
    It applies to both edges along the inline direction.
    inset-inline with two values
    Two values
    They apply respectively to the edge that is the start of the lines, and to the edge that is the end of the lines.

    e syntax of our example is equivalent to: inset-inline-start: 120px; inset-inline-end: 100px;

    The element can be resized if its dimension in the inline direction is not specified or is set to auto. However, if the element's dimension is defined in the inline direction, the second value of inset-inline is ignored.

  • inset-inline: initial; (auto) inset-inline: inherit; inset-inline: revert; inset-inline: revertLayer; inset-inline: unset;
    inset-block: initial; (auto) inset-block: inherit; inset-block: revert; inset-block: revertLayer; inset-block: unset;

    Common values ​​are presented on these pages: initial, inherit, revert, revert-layer, unset.

Animation of inset-block and inset-inline properties.

Movable elements can easily be created by setting their position (here to relative) and applying an animation on the properties inset-block and/or inset-inline.

Nostalgia for Space Invaders 1 Nostalgia for Space Invaders 2

 

Simulator for inset-block et inset-inline.

The blue element below is positioned absolutely (position:absolute). Its parent is positioned relatively, so it serves as a reference for the positioning of the blue block.

On the other hand, the width and height of the element have been defined, so it is unnecessary to specify two values for inset-block and inset-inline: only the first will be taken into account (see the explanations above regarding interactions with the dimensions of the element).


Writing mode:

inset-block :
inset-inline :

Absolutely positioned block

Compatibility.

Support for both properties inset-block and inset-inline is now complete.

Column 1
Browser support for the inset-block property to specify the block-axis location of a positioned element (position is absolute, fixed, etc.).
Column 2
Browser support for the inset-inline property to set the location in the inline direction of a positioned element (position is absolute, fixed, etc.).
1
inset-block
property
2
inset-inline
property
Estimated overall support.
95%
95%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

KaiOS Browser

Opéra Mobile

Opéra

Firefox pour Androïd

Samsung Internet

Chrome

Edge

Firefox

Androïd Brower

Chrome pour Androïd

Baidu Browser

QQ Browser

Safari

Safari sur IOS

UC Browser pour Androïd

Opéra mini

Historic of properties inset-block and inset-inline.

See also, regarding the positioning of the blocks.

The CSS specifications edited by the W3C are organized into modules. The inset-block and inset-inline properties are described in the CSS Positioned Layout Module.

Normally, CSS positions elements one after the other, ensuring that they do not overlap. This specification presents another way to position blocks, either relative to the page, relative to the screen, or relative to their normal position. The property definitions involved in this mechanism are listed below:

Properties:

bottom
Defines the space between the bottom of the element (if positioned) and the bottom of its parent.
inset
Sets the position of the element when it is positioned other than static. Short hand for top, right, bottom and left.
Inset-block
Defines the position of a positioned element in the block direction. Shorthand for inset-block-start and inset-block-end.
Inset-block-end
For a positioned element, sets the location of the end side of the block.
Inset-block-start
For a positioned element, sets the location of the edge on the start side of the block.
Inset-inline
Defines the position of a positioned element in the inline direction. Shorthand for inset-inline-start and inset-inline-end.
Inset-inline-end
On a positioned element, sets the location of the edge at the end of the line.
Inset-inline-start
On a positioned element, sets the location of the edge at the starting of the line.
left
For a positioned element, defines the space between the left edge of the element and the left edge of the reference element.
overlay
Langue française
Determine if a positioned element should be displayed above others.
position
Changes the positioning of an element, for example to make it fixed in relation to the page.
right
For a positioned element, defines the space between the right edge of the element and the right edge of the reference element.
top
For a positioned element, defines the space between the top of the element and the top of the reference element (positioned parent or viewport).
z-index
Langue française
Defines on which layer an element should be displayed (top, bottom). Especially useful for positioned elements.