文章详情页
css - 关于nth-child()的问题
浏览:185日期:2023-07-06 09:39:03
问题描述
span:nth-child(-n+3)匹配前三个子元素中的span元素为什么是匹配前3个元素??如果n是0开始的话,不应该是n+3吗?
问题解答
回答1:span:nth-child(n+3) 感觉是匹配的从第三个往后的所有 span 元素
n 应该是从 0,1,2,…… 加上负号才能保证 nth-chlid(里面的数字小于等于三)
回答2:Example:
-n+6 / represents the first 6 elements of the list /
The values of A and B can be negative, but only the positive results of An+B, >for n ≥ 0, are used.
你可以这样理解,n是从0开始计数(0,1,2...)所以(-n+6) => (6,5,4,3,2,1)所以是前六个上面的引用已经说了,只有正数会被使用。
标签:
CSS
相关文章:
1. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?2. docker内创建jenkins访问另一个容器下的服务器问题3. mac连接阿里云docker集群,已经卡了2天了,求问?4. dockerfile - 为什么docker容器启动不了?5. vim - docker中新的ubuntu12.04镜像,运行vi提示,找不到命名.6. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””7. 数据库 - mysql中怎样修改带点的字段名的位置?8. golang - 用IDE看docker源码时的小问题9. docker镜像push报错10. dockerfile - [docker build image失败- npm install]
排行榜

网公网安备