Remove display:inline
from #menu
and add text-align:center;
Demo Fiddle
This basically tells the ul
to center any textual content, as you have the li
set to display:inline-block
they are effectively treated as textual content so centered.
If you wish your button to appear next to the menu, you have a number of options, the 'easiest' is to apply float:left to it
There are really two main ways of centering content:
Text Alignment (inline elements): Set the child elements to either
display:inline
ordisplay:inline-block
, then set the parent container totext-align:center
, the children will center in the parent- depending on whatever its widthMargin Alignment (block elements): If the child content is block level (
display:block
) settext:align:center;
on the parent, then give the childmargin:0 auto
and a fixed width less than that of the parent