Fixed positioning follows a containing block that is usually the viewport. A transformed ancestor can establish a different reference frame.
Worked example
<style>
.demo {
position: fixed;
bottom: 1rem;
right: 1rem;
}
</style>
<div class="demo">Pin a label to the preview viewport</div>Implementation notes
Fixed elements can overlap zoomed text even when their desktop placement looks generous. A compact layout may need to put the label back in normal flow.
Try it yourself
Scroll the page, then add a transform to the label's ancestor.
Open the CSS example →Editorial date November 22, 2025 · Published December 6, 2026