Pinning an overlay to every edge of its parent used to take four declarations. The inset shorthand does it in one, with the same value pattern as margin.
.card { position: relative; }
.card .overlay {
position: absolute;
inset: 0;
}
With inset: 0 the overlay is stretched to fill the positioned parent. It is the same as writing top: 0; right: 0; bottom: 0; left: 0;.
Like margin, it accepts one to four values. Two values set top and bottom first, then left and right, and four values go clockwise from the top:
inset: 10px 20px; /* top/bottom 10px, left/right 20px */
inset: 5px 15px 10px 20px; /* top right bottom left */
It takes the same values as top, such as auto, lengths and percentages. Percentages refer to the width of the containing block for left and right, and to its height for top and bottom.
MDN marks inset as widely available, with support across browsers since April 2021, so you can use it without a fallback unless you still support very old browsers.
The caveat is that it only does something on positioned elements. If the element is position: static, which is the default, the offsets are ignored and you will stare at an unchanged page. Also, despite living in the logical properties specification, inset maps to physical sides. For offsets that follow the writing direction, use inset-inline and inset-block.
Further reading: MDN: inset