2013-03-02 13 views
0

我試圖去排隊頁腳菜單,只選擇第一個列表元素作爲單一選擇joomla的5 col footer菜單的css選擇器?

<ul class="someclass"> 
    <li><!--this is what I am trying to capture--> 

     <a>something arbitrary here</a> 
     <ul> 
      <li>list elemnts here</li> 
      <li>list elemnts here</li> 
      <li>list elemnts here</li> 
      <li>list elemnts here</li> 
     </ul> 
    </li> 
    <li> 
     <a>something arbitrary here</a> 
     <ul> 
      <li>list elemnts here</li> 
      <li>list elemnts here</li> 
      <li>list elemnts here</li> 
      <li>list elemnts here</li> 
     </ul> 
    </li> 
    <li> 
     <a>something arbitrary here</a> 
     <ul> 
      <li>list elemnts here</li> 
      <li>list elemnts here</li> 
      <li>list elemnts here</li> 
      <li>list elemnts here</li> 
     </ul> 
    </li> 
</ul> 

我希望能夠選擇所有頂部<li>元素,而不直接選擇每隔內飾<li>元素。我應該使用哪個css選擇器?

+0

'ul.someclass:first-child {...}'? – Vucko 2013-03-02 12:19:13

回答

1
.someclass > li:first-child { 
} 

例子:http://jsfiddle.net/yUMwD/

或選擇在該級別的所有li S:

.someclass > li { 
} 

>手段 '子元素',所以它會採取li就是直接.comeclass

+0

感謝您的快速響應,但它只是選擇第一組列表,而我的目的是分別選擇所有3組 – 2013-03-02 12:34:28

+0

我誤解了你的問題。查看更新的答案。 – MarcinJuraszek 2013-03-02 12:36:27

+0

非常感謝你** SO **。 – 2013-03-02 12:38:18