2017-04-17 59 views
0

不知道我哪裏去錯了。似乎無法讓我的子子菜單顯示在「Supai」選項卡下。我哪裏錯了?我可以讓子菜單工作,但不知何故Sub Sub不會顯示。呃Sub Sub Menu Code Broken?

此外,我相信你厭倦了這些子子菜單問題。我已經挖掘了他們,甚至使用了本網站上回復中使用的確切代碼。他們工作得很好,直到我將它們粘貼到我的博客上。在Blogger代碼本身內部思考可能會對我起作用。思考?

#cssnav { 
 
    float: left; 
 
    font: bold 12px Verdana, Helvetica, Sans-serif; 
 
    border: 2px solid #74BA94; 
 
    border-top: 1px solid #747BBA; 
 
    -webkit-border-radius: 5px; 
 
    -moz-border-radius: 5px; 
 
    border-radius: 5px; 
 
    overflow: hidden; 
 
} 
 

 
#cssnav ul { 
 
margin:0; 
 
padding:0; 
 
list-style:none; 
 
} 
 

 
#cssnav ul li { 
 
float:left; 
 
} 
 

 
#cssnav ul li a { 
 
    float: left; 
 
color:#EA1047; 
 
    padding: 10px 20px; 
 
text-decoration:none; 
 
    background:#3F10EA; 
 
    background: -webkit-gradient(linear, left bottom, left top, color-stop(0.09, rgb(59,63,65)), color-stop(0.55, rgb(72,76,77)), color-stop(0.78, rgb(75,77,77))); 
 
background: -moz-linear-gradient(center bottom, rgb(59,63,65) 9%, rgb(72,76,77) 55%, rgb(75,77,77) 78%); 
 
background: -o-linear-gradient(center bottom, rgb(59,63,65) 9%, rgb(72,76,77) 55%, rgb(75,77,77) 78%); 
 
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset, 0 0 5px rgba(0, 0, 0, 0.1) inset; 
 
border-left: 1px solid rgba(255, 255, 255, 0.05); 
 
     border-right: 1px solid rgba(0,0,0,0.2); 
 
    text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.6); 
 
} 
 

 
#cssnav ul li a:hover, 
 
#cssnav ul li:hover > a { 
 
    color: #252525; 
 
    background:#3C4042; 
 
background: -webkit-gradient(linear, left bottom, left top, color-stop(0.09, rgb(77,79,79)), color-stop(0.55, rgb(67,70,71)), color-stop(0.78, rgb(69,70,71))); 
 
background: -moz-linear-gradient(center bottom, rgb(77,79,79) 9%, rgb(67,70,71) 55%, rgb(69,70,71) 78%); 
 
background: -o-linear-gradient(center bottom, rgb(77,79,79) 9%, rgb(67,70,71) 55%, rgb(69,70,71) 78%); 
 
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2), 0 -1px #000; 
 

 
} 
 

 
#cssnav li ul a:hover, 
 
#cssnav ul li li:hover > a { 
 
    color: #2c2c2c; 
 
    background: #5C9ACD; 
 
background: -webkit-gradient(linear, left bottom, left top, color-stop(0.17, rgb(61,111,177)), color-stop(0.51, rgb(80,136,199)), color-stop(1, rgb(92,154,205))); 
 
background: -moz-linear-gradient(center bottom, rgb(61,111,177) 17%, rgb(80,136,199) 51%, rgb(92,154,205) 100%); 
 
background: -o-linear-gradient(center bottom, rgb(61,111,177) 17%, rgb(80,136,199) 51%, rgb(92,154,205) 100%); 
 
    border-bottom: 1px solid rgba(0,0,0,0.6); 
 
    border-top: 1px solid #7BAED9; 
 
    text-shadow: 0 1px rgba(255, 255, 255, 0.3); 
 
} 
 

 
#cssnav li ul { 
 
    background:#3C4042; 
 
    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.09, rgb(77,79,79)), color-stop(0.55, rgb(67,70,71)), color-stop(0.78, rgb(69,70,71))); 
 
    background-image: -moz-linear-gradient(center bottom, rgb(77,79,79) 9%, rgb(67,70,71) 55%, rgb(69,70,71) 78%); 
 
    background-image: -o-linear-gradient(center bottom, rgb(77,79,79) 9%, rgb(67,70,71) 55%, rgb(69,70,71) 78%); 
 
    border-radius: 0 0 10px 10px; 
 
    -moz-border-radius: 0 0 10px 10px; 
 
    -webkit-border-radius: 0 0 10px 10px; 
 
    left: -999em; 
 
    margin: 35px 0 0; 
 
    position: absolute; 
 
    width: 160px; 
 
    z-index: 9999; 
 
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4) inset; 
 
    -moz-box-shadow: 0 0 15px rgba(0, 0, 0, 0.4) inset; 
 
    -webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.4) inset; 
 
    border: 1px solid rgba(0, 0, 0, 0.5); 
 
} 
 

 
#cssnav li:hover ul { 
 
    left: auto; 
 
} 
 

 
#cssnav li ul a { 
 
    background: none; 
 
    border: 0 none; 
 
    margin-right: 0; 
 
    width: 120px; 
 
    box-shadow: none; 
 
    -moz-box-shadow: none; 
 
    -webkit-box-shadow: none; 
 
    border-bottom: 1px solid transparent; 
 
    border-top: 1px solid transparent; 
 
} 
 

 
#cssnav li li ul { 
 
    margin: -1px 0 0 160px; 
 
    -webkit-border-radius: 0 10px 10px 10px; 
 
    -moz-border-radius: 0 10px 10px 10px; 
 
    border-radius: 0 10px 10px 10px; 
 
    visibility:hidden; 
 
} 
 

 
#cssnav li li:hover ul { 
 
    visibility:visible; 
 
} 
 

 
#cssnav ul ul li:last-child > a { 
 
-moz-border-radius:0 0 10px 10px; 
 
-webkit-border-radius:0 0 10px 10px; 
 
border-radius:0 0 10px 10px; 
 
} 
 

 
#cssnav li:hover ul ul { 
 
    display:none; // hide the unordered list that is inside the unordered list 
 
} 
 
#cssnav li ul li:hover ul { 
 
    display:block; // display the unordered list in the same way as your sub menu 
 
} 
 
#cssnav ul ul ul li:first-child > a { 
 
-moz-border-radius:0 10px 0 0; 
 
-webkit-border-radius:0 10px 0 0; 
 
border-radius:0 10px 0 0; 
 
}
<!doctype html> 
 
<div id="cssnav"> 
 
<ul> 
 
\t <li><a href="www.example.com">Home</a></li> 
 
\t <li><a href="http://www.example.com/p/about-me.html">About Me</a></li> 
 
\t <li><a href="http://www.example.com/p/joc-series.html">JOC: Book Series</a></li> 
 
\t <li><a href="http://www.example.com/p/adventures.html">Adventures</a> 
 
\t \t <ul> 
 
\t \t \t <li><a href="http://www.example.com/p/adventures.html#SUP">Supai</a></li> 
 
\t \t \t \t <ul> 
 
\t \t \t \t \t <li><a href="#">Supai Walkthrough</a></li> 
 
\t \t \t \t \t <li><a href="#">The Drive</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#HTP">Hilltop</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#TRK">VillageTrek</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#VLG">Village</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#NJF">Navajo Falls</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#HSF">Havasu Falls</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#CMP">Campground</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#MNF">Mooney Falls</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#BTK">Beaver Trek</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#BVF">Beaver Falls</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#CTK">Colorado River Trek</a></li> 
 
\t \t \t \t \t <li><a href="http://www.example.com/p/adventures.html#CRV">Colorado River</a></li> 
 
\t \t \t \t </ul> 
 
\t \t \t <li><a href="http://www.example.com/p/adventures.html#NSW">Never Summer Wilderness</a></li> 
 
\t \t \t <li><a href="http://www.example.com/p/adventures.html#RRG">Red River Gorge</a></li> 
 
\t \t \t <li><a href="http://www.example.com/p/adventures.html#YEL">Yellowstone</a></li> 
 
\t \t \t <li><a href="http://www.example.com/p/adventures.html#SNP">Sequoia Nat'l Park</a></li> 
 
\t \t </ul> 
 
\t <li><a href="http://www.example.com/p/contest.html">Contest</a></li> 
 
\t <li><a href="http://www.example.com/p/fire.html">Fire Basics</a> 
 
</li></li></ul> 
 
</div> 
 

 
</!doctype>

回答

0

地方你的子子菜單列表標籤和樣式內(在另一個UL標籤包含)如下:

#cssnav ul li:hover #cssnav ul li ul li{ 
    left:100%; 
    overflow:visible; 
    top: 0px; 
margin: 0px; 
left: 100%; 
} 
#cssnav ul li ul:hover { 
    visibility:visible; 
    overflow:visible; 
} 

click here for demo

+0

我不明白。 @repzero,你的代碼在這裏效果很好,但是當我複製並粘貼到博客時,我只能得到一個子菜單而不是子子菜單。我以我的智慧結束了這一點。 http://www.journeysofthecrew.com/ –

+0

你可以創建一個筆或小提琴的整個頁面的內容?這可能是一些規則正在影響我試過的預期行爲 – repzero

+0

。字符太多。 Bummer –

1

每個子菜單ul有在之內li元上級菜單的,所以這段代碼...

<li><a href="http://www.journeysofthecrew.com/p/adventures.html#SUP">Supai</a></li> 
    <ul> 
     <li><a href="#">Supai Walkthrough</a></li> 
     <li><a href="#">The Drive</a></li> 
      [ etc. ] 
     <li><a href="http://www.journeysofthecrew.com/p/adventures.html#CRV">Colorado River</a></li> 
    </ul> 

...應該是

<li><a href="http://www.journeysofthecrew.com/p/adventures.html#SUP">Supai</a> 
    <ul> 
     <li><a href="#">Supai Walkthrough</a></li> 
     <li><a href="#">The Drive</a></li> 
     [ etc. ] 
     <li><a href="http://www.journeysofthecrew.com/p/adventures.html#CRV">Colorado River</a></li> 
    </ul> 
</li> 

(移動關閉li標籤)

+0

好的,我會試試看。謝謝你的提示! –