CSS Reference ยท Positioning and Stacking
The inset-block property
Reference for the CSS inset-block shorthand and its inset-block-start and inset-block-end longhands: writing-mode-aware offsets for positioned elements.
The inset-block property is a shorthand for inset-block-start and inset-block-end: the offsets along the block axis, the direction in which blocks stack. In ordinary horizontal English text the block axis is vertical, so inset-block-start behaves like top and inset-block-end like bottom. In vertical writing modes the axis turns, and the properties follow it.
Use it when your component must adapt to different writing modes or languages without separate rules.
.sticky-header { position: sticky; inset-block-start: 0; }
Try it
The same two declarations put the first tag in the top-left corner and the second in the top-right corner: in vertical-rl the block-start edge is on the right and the inline-start edge is at the top.
Syntax
inset-block: <'top'>{1,2}; inset-block-start: <'top'>; inset-block-end: <'top'>; inset-block: 0; /* start and end */ inset-block: 10px 40px; /* start 10px, end 40px */
- Initial value:
auto - Applies to: positioned elements
- Inherited: no
- Percentages: refer to the containing block's size in the block axis
- Animatable: yes, as lengths or percentages
- Computed value: as for the physical
topandbottom
Values
| Value | Description |
|---|---|
auto |
No offset on that side. |
<length> |
A fixed distance from the block-start or block-end edge. |
<percentage> |
A percentage of the containing block's block-axis size. |
| One value | Used for both start and end. |
| Two values | First is inset-block-start, second is inset-block-end. |
Usage notes
- Mapping. In
horizontal-tbthe start edge is the top; invertical-rlandvertical-lrthe block-start edge is the right or the left respectively, because lines flow sideways. - Direction does not matter here.
direction: rtlaffects the inline axis, so it leavesinset-block-*unchanged. For left/right-like offsets useinset-inline. - Same positioning rules. The element must be positioned, and the reference box is chosen by
positionas withtop. - Mixing with physical offsets. Logical and physical properties set the same underlying values; whichever comes last in the cascade wins.
Browser support
Supported in all modern browsers since 2021 (Baseline).
Related
inset-inline,insettop,bottom- Lessons: CSS Writing Modes, CSS Position