文章詳情頁
css - 關(guān)于nth-child()的問題
瀏覽:126日期:2023-07-06 09:39:03
問題描述
span:nth-child(-n+3)匹配前三個子元素中的span元素為什么是匹配前3個元素??如果n是0開始的話,不應(yīng)該是n+3嗎?
問題解答
回答1:span:nth-child(n+3) 感覺是匹配的從第三個往后的所有 span 元素
n 應(yīng)該是從 0,1,2,…… 加上負(fù)號才能保證 nth-chlid(里面的數(shù)字小于等于三)
回答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開始計數(shù)(0,1,2...)所以(-n+6) => (6,5,4,3,2,1)所以是前六個上面的引用已經(jīng)說了,只有正數(shù)會被使用。
標(biāo)簽:
CSS
相關(guān)文章:
1. python 利用subprocess庫調(diào)用mplayer時發(fā)生錯誤2. python文檔怎么查看?3. python - Pycharm的Debug用不了4. javascript - 關(guān)于apply()與call()的問題5. datetime - Python如何獲取當(dāng)前時間6. javascript - nginx反向代理靜態(tài)資源403錯誤?7. html - eclipse 標(biāo)簽錯誤8. 請問PHPstudy中的數(shù)據(jù)庫如何創(chuàng)建索引9. 安全性測試 - nodejs中如何防m(xù)ySQL注入10. python - pycharm 自動刪除行尾空格
排行榜

熱門標(biāo)簽