Fixed position doesn't work!

Problem
I used position:fixed on my nav bar but it doesn’t work :frowning:
Here’s my pen: https://codepen.io/CaptainHenry/pen/MWmgYxV
Thanks!

You have a stray backslash in your css. Remove that and add more content and you’ll see that it works.

1 Like

Thanks but now I got another problem with the content. It got the nav bar cover some first line!
Pen: https://codepen.io/CaptainHenry/pen/MWmgYxV?editors=1100
Thanks alot!

By positioning the header you removed it from the document flow. Now you need to create a space equal to the height of the header to push down your content.

1 Like

Thanks for replying! And I try make a div wrap the header and put it to relative but it doesn’t work. :sweat_smile:

Try a div with height and width between the header and the content or top margin on the next element after the header.

1 Like

Thanks it works great!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.