【问题标题】:CSS Center Submenu WordpressCSS 中心子菜单 Wordpress
【发布时间】:2012-03-23 13:44:09
【问题描述】:

您好,需要将我的 1000 像素宽度子菜单置于页面的中心。

我相信我的问题在于:

    position: absolute;
    top: 23px;
    left: 50%;

网站是:http://dev.timson.me(“即将上映”和“过往作品”的子菜单)

CSS 是:

#access {
    clear: both;
    display: block;
    float: left;
    margin: 0 auto 6px;
    padding-top: 8px;
    width: 100%;
    font-family: Stag;
    display:block;
    text-align:center;
}

#access ul {
    font-size: 13px;
    list-style: none;
    margin: 0 0 0 -0.8125em;
    padding-left: 0;

    display:inline-block;
}

.sub-menu {
    text-align: center;
}

#menu-default > li {
    float: left;
    position: relative;
}
.sub-menu > li {
    display: inline-block;
}

#access a {
    color: #eee;
    display: block;
    line-height: 25px;
    margin-top: -4px;
    margin-bottom: -4px;
    padding: 0 1.2125em;
    text-decoration: none;
}

#access ul ul {

    display: none;
    float: left;
    margin-top: 0;
    position: absolute;
    top: 23px;
    left: 50%;
    width: 1000px;
    z-index: 99999;
    margin-left:-500px;
    text-align:center;
    padding-top:5px;
    padding-bottom:10px;

    background: red;
}

#access ul ul a {

    margin-top: 0px;
    margin-right: auto;
    margin-bottom: 0px;
    margin-left: auto;
    padding-bottom:10px;

}

#access ul li:hover > ul {
    display: block;
}

非常感谢任何帮助。

干杯, 彼得

【问题讨论】:

    标签: html css wordpress menu navigation


    【解决方案1】:

    尝试从主导航#menu-default > li 中删除position: relative; 并将position: relative; 添加到主导航#access ul

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 2017-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多