I'm new here! css position help

How do i make an ul (lets say navigation header) to be in the middle of the page?
I did-
{
position: fixed;
width: 100%;
z-index: 2;
margin: 0 auto;
}
but its still stick to the left

I’m new here, and to programming and web developing in general
so thank you in advance and nice to meet you!
Eli

when using position: fixed, you also need left: auto and right: auto along with margin: 0 auto if i remember correctly

you can google this: css center fixed element

still didn’t solve it…
but thank you!

the width is 100%, so why should it center? I can only suggest things, if i actually need to fix it, you will need to provide your code (you could make a codepen, jsfiddle or jsbin (this are websites))

https://codepen.io/mediarcoiris/pen/mdywgyK
thats really cool!!!

so i want the “color” “fonts” “text style” at the top bar to by in the middle…

there is still lots where to improve… but hey its my first week!

i would then make the div (with class menu) fixed. Then centering an unordered list seems a bit tricky, but i simply googled that and got to:

.menu {
  position: fixed;
  width: 100%;
  z-index: 3;
  z-index: 3;
  background-color: rgb(69, 19, 78);
  top: 0;
}
.menu ul {
  display: table;
  margin: 0 auto;
}

also, anchor elements (<a></a>) won’t inherit color

bonus recommendation:

html, body {
  margin: 0;
} 

to overwrite the default body margin (most browsers have this)

yayyy!!!
thanks a lot!!!