2012-03-06 64 views
0

嗨需要居中我的1000px寬度的子菜單頁面。CSS中心子菜單WordPress的

我相信我的問題在於:

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; 
} 

任何幫助,非常感謝。

乾杯, 彼得

回答

0

嘗試從您的主要導航#menu-default > li去除position: relative;並添加position: relative;到主#access ul

+0

三江源非常多的工作就像一個魅力:) – ptimson 2012-03-06 11:05:28

+0

真棒!很高興它工作:) – blackpla9ue 2012-03-06 11:17:12