css选择器预嵌套列表项 [英] css selector pre-nesting list item
本文介绍了css选择器预嵌套列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<ul class="someclass">
<li>
<a>something arbitrary here</a><!--this is what I am trying to capture-->
<ul>
<li><a>list elemnts here</a></li>
<li><a>list elemnts here</a></li>
<li><a>list elemnts here</a></li>
<li><a>list elemnts here</a></li>
</ul>
</li>
<li>
<a>something arbitrary here</a><!--this is what I am trying to capture-->
<ul>
<li><a>list elemnts here</a></li>
<li><a>list elemnts here</a></li>
<li><a>list elemnts here</a></li>
<li><a>list elemnts here</a></li>
</ul>
</li>
</ul>
我试图使用CSS提取标记的第一个列表项。我应该使用哪个css选择器?提前感谢!
I am trying to use CSS to "extract" the first list items that are marked. which css selectors should I use? thanks in advance!
推荐答案
使用>
选择直接子元素: http://jsfiddle.net/v25s5/
Use >
to select direct child elements: http://jsfiddle.net/v25s5/
.someclass > li > a {
color: red;
}
这篇关于css选择器预嵌套列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文