2013-03-02 37 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