<?xml version="1.0" encoding="utf-8"?>

CSS position property with the fixed value

An element with a fixed value for the position property, similar to one in an absolute position, is removed from the page's flow, and the browser will display it on top of un-positioned elements. The difference is that the offset of an element with position: fixed; is calculated from the browser window, also called the viewport. In practice, this means that a fixed element doesn't move when you scroll the page.

In the example, the yellow element with position: fixed; is stuck on top of the page, and will stay there when you scroll.

Improve your UX & Product skills with interactive courses that actually work