css - wordpress中的中心导航

标签 css wordpress navigation

我试图在这里的其他线程中找到答案,但没有找到对我有用的答案。我想将主要导航文本居中。这是网站:http://goo.gl/kJBnmw

与导航相关的 CSS 很长,我不确定必须更改哪一部分,所以我包含了整个 CSS:

/*-[ Navigation ]-----------------*/
.secondary-navigation .children li .sf-sub-indicator { display: none }

.secondary-navigation {
    display: block;
    float: right;
    width: 100%;
    height: 39px;
}
.secondary-navigation ul li { }
.secondary-navigation a {
    font-size: 13px;
    color: #fff;
    text-align: left;
    text-decoration: none;
    padding: 10px 14px;
    font-weight: bold;
}
.secondary-navigation a .sub {
    font-size: 11px;
    font-weight: normal;
    font-family: arial;
    color: #9B9B9B;
}
.sf-js-enabled li a.sf-with-ul { padding-right: 20px }
.sf-js-enabled li  ul.sf-with-ul { padding-right: 20px }
#navigation .sf-sub-indicator {
    display: block;
    width: 10px;
    overflow: hidden;
    position: absolute;
    right: 5px;
    top: 9px;
}
#navigation {
    font-size: 13px;
    float: left;
    width: 100%;
    background-color: #535353;
}
#navigation select { display: none }
#navigation ul {
    width: 980px;
    margin: 0 auto;
}
#navigation .menu { }
#navigation ul li {
    float: left;
    position: relative;
}
#navigation ul .header-search { float: right }
#navigation > ul > li:last-child { border-right: none }
#navigation ul li a, #navigation ul li a:link, #navigation ul li a:visited {
    overflow: hidden;
    display: block;
    font-family: "Helvetica Neue", Arial, sans-serif;
    text-transform: capitalize;
}
#navigation ul li a:hover {
    background: #C1377F;
    color: #fff;
}
#navigation > ul > .current a {
    background: transparent;
    color: #5a5a5a !important;
}
#navigation ul li li {
    background: #fff;
    border: 1px solid #eee;
    border-bottom: 0;
}
#navigation ul li li:first-child { border-top: 0 }
#navigation ul ul {
    position: absolute;
    width: 190px;
    padding: 0;
    z-index: 400;
    font-size: 12px;
    color: #798189;
    border-bottom: 1px solid #eee;
}
#navigation ul ul li { padding: 0 }
#navigation ul ul a, #navigation ul ul a:link, #navigation ul ul a:visited {
    padding: 9px 20px;
    position: relative;
    width: 150px;
    border-left: 0;
    background: transparent;
    border-right: 0;
    -moz-border-radius: 0;
    -webkit-border-radius: 0;
    border-radius: 0;
    border-bottom: 1px solid   rgba(255, 255, 255, 0.05);
    margin: 0;
    color: #555;
}
#navigation ul ul a:hover {
    color: #C1377F;
    background: whiteSmoke!important;
}
#navigation ul ul li:first-child a { }
#navigation ul ul li:last-child a { border-bottom: none }
#navigation ul ul {
    opacity: 0;
    left: -999em;
}
#navigation ul li:hover ul {
    left: auto;
    opacity: 1;
}
#navigation ul ul ul { top: -10px }
#navigation li:hover ul ul, #navigation li:hover ul ul ul, #navigation li:hover ul ul ul ul {
    left: -999em;
    opacity: 0;
}
#navigation li:hover ul, #navigation li li:hover ul, #navigation li li li:hover ul, #navigation li li li li:hover ul {
    opacity: 1;
    left: 195px;
}
#page-header:after, #navigation ul ul:after {
    content: "";
    display: block;
    height: 0;
    position: absolute;
    width: 0;
}
#navigation ul ul:after {
    left: 10px;
    top: 0px;
}
#navigation ul ul ul:after {
    left: -12px;
    top: 3px;
}

这是我认为应该相关的 php 代码:

<!--#header-->
        <div class="secondary-navigation">
            <nav id="navigation" >
                <?php if ( has_nav_menu( 'primary-menu' ) ) { ?>
                    <?php wp_nav_menu( array( 'theme_location' => 'primary-menu', 'menu_class' => 'menu', 'container' => '' ) ); ?>
                <?php } else { ?>
                    <ul class="menu">
                        <?php wp_list_categories('title_li='); ?>
                    </ul>
                <?php } ?>
            </nav>
        </div>
    </div>   

如有任何帮助或想法,我们将不胜感激。

谢谢

最佳答案

像这样:

#navigation ul li {
    float: none;
    vertical-align: top;
    display: inline-block;
    position: relative;
}

关于css - wordpress中的中心导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20922898/

相关文章:

java - 在 Java Web 应用程序中动态添加外部 JavaScript 或 CSS 文件

css - 为什么我的字体不能在移动设备上运行?

javascript - Firefox 中 Flash 顶部的 CSS/JavaScript 导航菜单

html - float : right; in <ul> (nav)

javascript - 加载特定 Javascript 后显示页面

css - 如何创建 CSS 类 Union?

php - 将自定义分类中的术语元添加到购物车项目

html - 我可以在导航背景图像上制作一个不可见的 Floating Div 以使标题可点击,wordpress 工具箱主题吗?

html - 固定导航栏在从导航跳转到页面的一部分时隐藏内容

php - php wordpress 根据非本地IP地址条件隐藏特定导航项