You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 16, 2026. It is now read-only.
When an element’s position is set to absolute, as in the last exercise, the element will scroll with the rest of the document when a user scrolls.
We can fix an element to a specific position on the page (regardless of user scrolling) by setting its position to fixed, and accompanying it with the familiar offset properties top, bottom, left, and right.
.title {
position: fixed;
top: 0px;
left: 0px;
}
In the example above, the .title element will remain fixed to its position no matter where the user scrolls on the page.
This technique is often used for navigation bars on a web page.
Position: Fixed
When an element’s position is set to absolute, as in the last exercise, the element will scroll with the rest of the document when a user scrolls.
We can fix an element to a specific position on the page (regardless of user scrolling) by setting its position to fixed, and accompanying it with the familiar offset properties top, bottom, left, and right.