On this page
inset
Prev: `position` | Up: positioning | Next: `z-index`
Rel: positioning, Positioning & Stacking Guide
Ref: MDN Web Docs — inset
Tags: #public #web #css #properties #positioning #tier/core
Syntax & Overview
inset: 0; /* shorthand for top right bottom left */
Logical/physical offset shorthand for positioned elements.
- Initial:
auto| Inherited: No | Animatable: Yes
Notes & Best Practices
- Logical shorthand for
top,right,bottom,left:inset: 0stretches anabsolute/fixedoverlay cleanly across its containing block.
Example
.overlay {
position: fixed;
inset: 0;
background: rgb(0 0 0 / 0.5);
}
Linked from
Related notes
- tuts/css/properties/positioning/position Linked here; links to this page; shared tags: #css, #positioning, #properties, #tier, #web
- tuts/css/properties/positioning/z-index Linked here; links to this page; shared tags: #css, #positioning, #properties, #tier, #web
- tuts/css/properties/positioning Linked here; links to this page; shared tags: #css, #positioning, #properties, #web
- tuts/css/properties/positioning_and_stacking Linked here; shared tags: #css, #positioning, #properties, #web
- tuts/css/properties/positioning/contain shared tags: #css, #positioning, #properties, #tier, #web
- tuts/css/properties/positioning/isolation shared tags: #css, #positioning, #properties, #tier, #web
- tuts/css/properties/box_model/aspect-ratio shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/box-sizing shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/inline-size shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/margin shared tags: #css, #properties, #tier, #web