use*_*591 3 css css-selectors css3
我遇到的问题是我得到了一些可变数量的子元素.我的:最后一个孩子:只有至少3个孩子时才应用第一胎规则
我试过:only-child,可以覆盖:last-和:first-child只有1个孩子,但是当我有2个孩子时,我有一个问题.是否存在某种选择器,只有当孩子多于n时才适用?
Rob*_*b W 14
使用:nth-child(n+3)选择器(其中3是最小的第n个孩子).
:last-child:nth-child(n+3) {
/* Selects the last child which is at least the third child */
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3312 次 |
| 最近记录: |