gpt4 book ai didi

css 选择器预嵌套列表项

转载 作者:行者123 更新时间:2023-11-28 13:14:06 25 4
gpt4 key购买 nike

    <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 选择器?提前致谢!

最佳答案

使用>选择直接子元素:http://jsfiddle.net/v25s5/

.someclass > li > a {
color: red;
}

关于css 选择器预嵌套列表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15175121/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com