CSS Reference ยท Positioning and Stacking
The inset-inline property
Reference for the CSS inset-inline shorthand with inset-inline-start and inset-inline-end: direction-aware offsets for positioned elements in LTR and RTL.
The inset-inline property is a shorthand for inset-inline-start and inset-inline-end: offsets along the inline axis, the direction in which text runs. In left-to-right text, start is the left edge and end is the right edge. In right-to-left text (Arabic, Hebrew) they swap automatically, so a badge placed with inset-inline-end: 8px always sits at the end of the line.
This makes it the right choice for international sites that need one set of rules for both directions.
.badge { position: absolute; inset-block-start: 8px; inset-inline-end: 8px; }
Try it
Syntax
inset-inline: <'top'>{1,2}; inset-inline-start: <'top'>; inset-inline-end: <'top'>; inset-inline: 0; /* both ends */ inset-inline: 12px auto; /* start 12px, end auto */
- Initial value:
auto - Applies to: positioned elements
- Inherited: no
- Percentages: refer to the containing block's size in the inline axis
- Animatable: yes, as lengths or percentages
- Computed value: as for the physical
leftandright
Values
| Value | Description |
|---|---|
auto |
No offset on that side. |
<length> |
A fixed distance from the inline-start or inline-end edge. |
<percentage> |
A percentage of the containing block's inline size. |
| One value | Applied to both start and end. |
| Two values | First is inset-inline-start, second is inset-inline-end. |
Usage notes
- Direction decides the mapping. The
directionproperty (or thedirattribute) and the writing mode determine which physical side "start" is. - Centering.
inset-inline: 0; margin-inline: auto; width: 20rem;centers an absolutely positioned element horizontally, in any direction. - Stretching. With both values set and
width: auto, the element stretches between the two edges. - Icons do not flip. Logical offsets move the box, but directional images such as arrows still need their own mirroring.
- Physical shorthand.
inset-inline: 0is not the same asinset: 0, which sets all four sides.
Browser support
Supported in all modern browsers since 2021 (Baseline).
Related
inset-block,insetleft,rightmargin-inline- Lessons: CSS Writing Modes, CSS Position