gpt4 book ai didi

css - 如何用CSS匹配最后n个 child ?

转载 作者:技术小花猫 更新时间:2023-10-29 11:30:53 25 4
gpt4 key购买 nike

我们想要匹配父容器的最后 12 个元素。如何用 CSS 做到这一点?澄清一下,12 是一个任意数字。我们想知道如何匹配父容器的最后 N 个元素。

最佳答案

绝对 :nth-last-child(N)

li:nth-last-child(-n+12) {
/*your css declarations*/
}

此示例选择器将匹配任何列表中的最后 12 个列表项,无论是有序的还是无序的:

关于css - 如何用CSS匹配最后n个 child ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12430174/

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