Centering a fixed nav element

I’m currently working on the layout of my product landing page and want to center the nav element that is fixed to the top of the screen. margin: auto; in the CSS isn’t working. I’m pretty sure that it’s because either it has the display property set to fixed or that display is set to flex. Any ideas on how this can be done?
This is the link to the code:
https://codepen.io/veryeager/pen/pMdvrG

HI, you might want to use Width: 100% on the navbar element. Although I am not sure if that is what you’re talking about. If you want the size of the navbar to be 50% then center it you will have to put it in a container and make sure the parent element is the width you desire to be centered using margin: 0 auto.

try navbar position fixed

@raregamer: Putting it in a container and setting it to margin: auto didn’t work. I tried it before and have it in there now.

Hi this might be what your looking for visually. https://codepen.io/raregamer/pen/qBWjQvY. You can see I used a display flex as a wrapper, you can nest them. I think this is what you are trying to accomplish, but I am not 100% sure. If you have any questions I will be glad to help.

Perfect. So you have to have the container display set to flex for it to work. Thank you raregamer.