The inset property is a shorthand for top, right, bottom, and left. It uses the same 1–4 value pattern as margin.
It only affects positioned elements (relative, absolute, fixed, or sticky). The offsets are physical, not logical — for writing-mode-aware sides use inset-block and inset-inline.
Baseline · Widely available.
Not deprecated and not experimental. Supported in modern browsers since April 2021. Internet Explorer does not support inset.
Syntax
CSS Syntax
syntax.css
inset:<length> | <percentage> | auto | initial | inherit;
Like margin: one value = all sides; two = top/bottom then left/right; three = top, left/right, bottom; four = top, right, bottom, left. Each longhand starts as auto. The property is not inherited.
Order matters. Four values mean top, right, bottom, left.
Top 10px, right 20px. First two numbers set those edges.
Bottom 30px, left 40px. Last two finish the rectangle.
Same as longhands. Equivalent to setting each of top/right/bottom/left alone.
Edge Cases & Pitfalls
If inset seems ignored, check these first.
position
Static elements ignore inset
Set position to relative, absolute, fixed, or sticky first.
physical
inset is not logical
It always means top/right/bottom/left. For writing-mode-aware offsets use inset-block and inset-inline.
margin
Do not confuse with margin
margin spaces boxes in flow. inset offsets a positioned box against its containing block.
width
Fixed width fights stretch
If you set both inset: 0 and a fixed width/height, the size may not fill the parent the way you expect. Prefer auto size when stretching.
order
Four values are clockwise from top
Remember: top → right → bottom → left — the same order as margin and padding shorthands.
Compatibility
Browser Support
inset is a browser CSS property for positioned offsets. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
inset
Chrome 87+, Edge 87+, Firefox 66+, Safari 14.1+. Internet Explorer has no support — fall back to top/right/bottom/left there.
96%Modern browser support
Google Chrome87+
Full support
Mozilla Firefox66+
Full support
Apple Safari14.1+
Full support
Microsoft Edge87+
Full support
Opera73+
Full support
Samsung Internet14+
Full support
Internet ExplorerNo support
Not supported
insetWidely supported
Bottom line: Safe for modern sites. For Internet Explorer, write top, right, bottom, and left instead. It is not a runtime API.
Remember
Key Takeaways
Role: shorthand for physical top, right, bottom, and left.
Needs position: relative, absolute, fixed, or sticky.
Handy pattern:inset: 0 fills a positioned containing block.
Not logical: use inset-block / inset-inline for writing-mode sides.
One line: positioned box + inset: 16px; = four physical offsets in one rule.
Frequently Asked Questions
It is a shorthand for top, right, bottom, and left. One declaration can set all four physical offsets on a positioned element.
Each side defaults to auto, the same as the longhand properties. That leaves placement to other rules such as static position.
No. inset has no effect unless position is relative, absolute, fixed, or sticky.
No. Despite living near logical inset-* properties in the specs, inset always maps to physical top, right, bottom, and left. For logical sides use inset-block and inset-inline.
It sets every offset to 0, so the absolute element stretches to fill its positioned containing block (when width and height are auto).
It is Baseline Widely available. Chrome 87+, Edge 87+, Firefox 66+, and Safari 14.1+ support it. Internet Explorer does not. It is a browser CSS property, not a Node.js feature.