文章詳情頁
css - 關于nth-child()的問題
瀏覽:108日期: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(里面的數(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ù)會被使用。
標簽:
CSS
相關文章:
1. [python2]local variable referenced before assignment問題2. thinkPHP5中獲取數(shù)據(jù)庫數(shù)據(jù)后默認選中下拉框的值,傳遞到后臺消失不見。有圖有代碼,希望有人幫忙3. mysql主從 - 請教下mysql 主動-被動模式的雙主配置 和 主從配置在應用上有什么區(qū)別?4. 求救一下,用新版的phpstudy,數(shù)據(jù)庫過段時間會消失是什么情況?5. linux運維 - python遠程控制windows如何實現(xiàn)6. python小白,關于函數(shù)問題7. django - Python error: [Errno 99] Cannot assign requested address8. python小白 關于類里面的方法獲取變量失敗的問題9. Python2中code.co_kwonlyargcount的等效寫法10. android - 請問一下 類似QQ音樂底部播放 在每個頁面都顯示 是怎么做的?
排行榜

熱門標簽