Code Editor
Web Browser

When an element's position is set to absolute, as in the last exercise, the element will scroll out of view 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.

.box-bottom { background-color: DeepSkyBlue; position: fixed; top: 20px; left: 50px; }

In the example above, the div will remain fixed to its position no matter where the user scrolls on the page, like in the image below:

This technique is often used for navigation bars on a web page.

Report a Bug
If you see a bug or any other issue with this page, please report it here.