Offsets (top/right/bottom/left and logical inset properties) move positioned elements.
Offset rules
- Offsets do nothing on
position: static. - Use logical properties (
inset-inline-start) for i18n-friendly layouts. - Prefer transforms for animation movement to avoid layout thrash.
Debug this snippet
.toast {\n top: 1rem;\n right: 1rem;\n}
Fix: add position: fixed or absolute; offsets alone are ignored in static flow.
Important interview questions and answers
- Q: Why are offsets ignored sometimes?
A: Element is still static-positioned. - Q: Offset vs transform translate?
A: Offsets affect layout positioning context; transforms are often better for animated movement. - Q: Why prefer logical inset properties?
A: Better support for writing modes and RTL layouts.
Pitfall: Check cascade order—author stylesheet loses to inline styles and !important surprises.