Positioning in Practice
Using the fixed position also allows you to develop “sticky” headers or menu bars. Study the following example to learn how to create a “sticky header and menu.”
Notice that when you scroll the example below, the header stays in place. Also, notice that in order to accomplish this look, we have to move the .main-content
container down so that it does not appear behind the header.
- Previous
- Next