--- title: Lock an Element to the Browser Window with Fixed Positioning ---  Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program  and write your own code  ## Lock an Element to the Browser Window with Fixed Positioning ##  Hint: 1 Use `position: fixed;`. > _try to solve the problem now_ ##  Hint: 2 Use the `left` and `top` properties. > _try to solve the problem now_ ## Spoiler Alert!  **Solution ahead!** ```html
I shift up when the #navbar is fixed to the browser window.
``` ### Code Explanation: * `#navbar{}` selects all the elements with the ID of `navbar`. * `position: fixed;` positions the element with respect to the viewport i.e. the output screen in this case. * `top: 0px;` and `right: 0px;` offsets the element by `0px` to the top and left respectively and it is placed in the top-left corner of the screen.