Inset Property

Last updated: 2026-09-13

inset Inset Property

The inset property is the shorthand for the four offset properties top, right, bottom, and left, setting a positioned element's offsets on all sides at once. Its default value, auto, means no offset. It only applies to elements with a non-static position, and its syntax mirrors margin, supporting 1 to 4 values.

Category
Initial Valueauto
InheritedNo
Applies To
Animation Type
CSS VersionCSS3
StatusStandard

📝 Syntax

inset: auto | <length> | <percentage>;

⚙️ Values

ValueTypeDescription
autoKeywordNo offset.
<length> | <percentage>TypeShorthand for offsets on all four sides.

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
inset v79 v12 v52 v10.1 v44
Supported in all major browsers
Tip: inset:0 makes an absolutely positioned element cover its parent completely, commonly used for overlay and full-screen cover layers.

❓ FAQ

QWhat's the difference between inset and top/right/bottom/left?
Ainset is the shorthand for top, right, bottom, and left, setting all four directions in a single declaration for cleaner code; the four individual properties give precise control over one direction at a time and can be mixed with inset, where individual values win. Both ultimately set the same offsets on a positioned element with the same value types, so they are interchangeable.
QHow many values does inset accept?
AOne to four, following the same rules as margin: one value sets all four sides, such as inset:10px; two set top and bottom plus left and right, such as inset:10px 20px; three set top, left and right, and bottom; four set top, right, bottom, left clockwise. Values can mix auto, lengths, and percentages freely, so inset:0 10px 20px 30px sets each side independently in a single declaration.
QWhat does inset:0 do?
Ainset:0 sets top, right, bottom, and left all to 0. For an absolute element inside a relative parent, it stretches to fill the parent completely, which is typically used for overlay layers, full-screen covers, and loading masks with a semi-transparent background. If width and height are also set, it is equivalent to placing the element at the parent's top-left corner.
QWhat is the browser support for inset?
Ainset is a modern logical property supported in Chrome 87+, Edge 87+, Firefox 66+, and Safari 14.1+, so all mainstream browsers can use it. For very old browsers, fall back to the four individual top, right, bottom, and left properties. The logical variants inset-block and inset-inline shipped a bit later, so keep that distinction in mind when using them, and always test the physical versus logical behavior in your target browsers.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏