[英]Advanced element selection using nth-child()
I have a little problem with the nth-child
selection. 我和
nth-child
选择有点问题。 I need to get the next serie of number for apply a style: 我需要获得下一个数字系列来应用一种风格:
3,4,7,8,11,12,15,16,.... 3,4,7,8,11,12,15,16,...
My solution is using two css rules: 我的解决方案是使用两个css规则:
.info div:nth-of-type(4n+4),
.info div:nth-of-type(4n-1)
But i want to know if it is possible using just one single selector. 但我想知道是否可以只使用一个选择器。
Yes, you can use 是的,你可以使用
div:not(:nth-child(4n+1)):not(:nth-child(4n+2))
but in my opinion the original version is more readable. 但在我看来,原始版本更具可读性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.