居中导航菜单

时间:2013-02-22 23:30:16

标签: css menu center

一直试图在横幅(link)正上方整理导航栏的中心位置。通过这里的几个解决方案,我已经玩了自定义CSS尝试某些变化,但仍然无法得到我想要的。简而言之,我只是想让菜单居中。我已经读过它必须是固定的宽度,但后来听到了。希望解决方案是我可以解决的问题。

由于

1 个答案:

答案 0 :(得分:0)

您需要从样式表中删除一些css规则并添加一些 - 请参阅下面的css以获得所需的布局。

CSS:

#header #navigation {
    /*float: left;*/ /* remove this property*/
}
#header #navigation {
    background: none repeat scroll 0 center transparent;
    box-shadow: none;
    clear: none;
    /*float: right;*/ /* remove this property*/
    /*width: auto;*/ /* remove this property*/
    width: 285px; /* add width here to get the actual width of menu so we can make it center*/
}

参见屏幕截图:

enter image description here