我正在尝试在看起来像这样的代码中选择最后一个 child 的最后一个 child (带有文本“this one”)
<div class="block">
<div></div>
<div></div>
<div></div>
<div>
<div></div>
<div></div>
<div>this one</div>
</div>
</div>
我尝试了 .block:last-child:last-child
但没有成功。
PS: 我无法添加 css 类
最佳答案
要定位到这个,您可以使用以下内容:
.block > :last-child > :last-child {
background-color: green;
}
这显然只是创建了一个绿色背景,将其更改为任何你想要的。
关于css - 如何选择最后一个 child 的最后一个 child ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48543642/