Sjors Luyckx Sjors Luyckx - 1 year ago 141
CSS Question

Center display-inblock

On (my site) I would like to place the menubar in the center of the page.
Here the code of my menubar:

#navigation {
padding-bottom: auto;
width: 960px;
margin: auto;
text-align: center;
text-transform: uppercase;
overflow: hidden;
font-family: 'Raleway', sans-serif;
font-size: 13px;
background-color: #DDDDDD;
border: 0px solid;
border-radius: 15px;
color: #000000;
display: inline-block;

Thanks in advance for helping me! :)

Answer Source

Add width: 100%; to your #navigation for a full-wdith centered menu.

Or change the display to block for a centered menu without a full-width background.

If you want to keep the yellow line under, add a 1px bottom margin. This will shift the rest one pixel lower and it will reveal a yellow line.

margin-bottom: 1px

Working JSFiddle for this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download