文章詳情頁
css - 關于nth-child()的問題
瀏覽:81日期: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. python - django 里自定義的 login 方法,如何使用 login_required()2. python如何不改動文件的情況下修改文件的 修改日期3. angular.js - angularjs 用ng-reapt渲染的dom 怎么獲取上面的屬性4. angular.js - 不適用其他構建工具,怎么搭建angular1項目5. mysql優化 - mysql count(id)查詢速度如何優化?6. 主從備份 - 跪求mysql 高可用主從方案7. css3 - [CSS] 動畫效果 3D翻轉bug8. node.js - node_moduls太多了9. mysql主從 - 請教下mysql 主動-被動模式的雙主配置 和 主從配置在應用上有什么區別?10. java8中,邏輯與 & 符號用在接口類上代表什么意思
排行榜
![css3 - [CSS] 動畫效果 3D翻轉bug](http://www.cgvv.com.cn/attached/image/news/202304/110831f073.png)