2011-08-10 86 views
0

我有一個3級深度無序列表,我正在創建一個下拉菜單來擴展this 2級簡單下拉菜單。該CSS如下:造型三級無序列表

@CHARSET "ISO-8859-1"; 
/* menu styles */ 

/* Top-level (Styles Works) */ 
#jsddm 
{ margin: 0; 
    padding: 0} 

    #jsddm li 
    { float: left; 
     list-style: none; 
     font: 12px Tahoma, Arial;} 

    #jsddm li a 
    { display: block; 
     /*background: #324143; Old Style*/ 
     background: -webkit-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* Chrome10+,Safari5.1+ */; 
     padding: 5px 12px; 
     text-decoration: none; 
     border-right: 1px solid white; 
     width: 70px; 
     /*color: #EAFFED; Default color*/ 
     color: #000099; 
     white-space: nowrap;} 


    #jsddm li a:hover 
    { background: #24313C} 

     /* 2nd-level (Styles Works) */ 
     #jsddm li ul 
     { margin: 0; 
      padding: 0; 
      position: absolute; 
      visibility: visible; 
      border-top: 1px solid white} 

      #jsddm li ul li 
      { float: none; 
       display: inline} 

      #jsddm li ul li a 
      { width: auto; 
       background: #dfeffc; 
       color: #24313C} 

      #jsddm li ul li a:hover 
      { background: #5c9ccc} 

       /* 3rd-level (Doesn't apply styles) */ 
       #jsddm li ul li ul 
       { margin: 0; 
        padding: 0; 
        position: absolute; 
        visibility: hidden; 
        border-top: 2px solid green} 

的造型適用於前兩個級別,而不是第三,我不知道我是否有語法正確,或者還有別的我失蹤。 html如下:

<div id="dropDownDiv"> 
     <ul id="jsddm"> 
      <li><a class="btn" href="#">Top Item 1</a> 
       <ul> 
        <li><a id="" class="btn" href="#">2nd Level Item 1</a></li> 
        <li><a href="#">2nd Level Item 2</a></li> 
       </ul> 
      </li> 
      <li><a class="btn" href="#">Top Item 2</a> 
       <ul> 
        <li><a id="" class="btn hide" href="#">2nd Level Item 1</a></li> 
         <ul> 
          <li><a id="" class="btn hide" href="#">3rd Level Item 1</a></li> 
          <li><a id="" class="btn" href="#">3rd Level Item 1</a></li> 
         </ul> 
        <li><a id="" class="btn" href="#">2nd Level Item 1</a></li> 
       </ul> 
      </li> 
     </ul> 
    </div> 

任何建議表示讚賞。

更新:

感謝您借給我你的眼睛Gareth。修正HTML:

 <ul id="jsddm"> 
      <li><a class="btn" href="#">Top Item 1</a> 
       <ul> 
        <li><a id="" class="btn" href="#">2nd Level Item 1</a></li> 
        <li><a href="#">2nd Level Item 2</a></li> 
       </ul> 
      </li> 
      <li><a class="btn" href="#">Top Item 2</a> 
       <ul> 
        <li><a id="" class="btn hide" href="#">2nd Level Item 1</a> 
         <ul> 
          <li><a id="" class="btn hide" href="#">3rd Level Item 1</a></li> 
          <li><a id="" class="btn" href="#">3rd Level Item 1</a></li> 
         </ul> 
        </li> 
        <li><a id="" class="btn" href="#">2nd Level Item 1</a></li> 
       </ul> 
      </li> 
     </ul> 

回答

1

你的第三個層次ul是不是包含在li內。這可能會導致你的問題。

+0

啊哈我現在看到它,謝謝加雷斯。我覺得有些標籤丟失了。 – kingrichard2005