Borja Borja - 5 months ago 8
HTML Question

Centering links within navigation menu

I'm buidling my site and I'm trying to horizontal centering the following code with no luck: http://codepen.io/anon/pen/LZZJrK

If I'm not wrong I must add a css code for

nav ul
so I added the following code but it's not working:

nav ul li {
display:block;
text-align:center;
}


Can someone please tell me how can I center the menu so I can have the following output? Thanks in advance.
enter image description here

Answer
  1. Remove the float: left property from nav ul li and nav li
  2. Change display:block to display: inline-block for li
  3. Add the following to your css:

#nav ul {
  text-align:center;
}

CodePen: http://codepen.io/anon/pen/XKKPGO

Comments