文章詳情頁
css - 關于nth-child()的問題
瀏覽:113日期: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. angular.js - angular內容過長展開收起效果2. docker網絡端口映射,沒有方便點的操作方法么?3. docker - 各位電腦上有多少個容器啊?容器一多,自己都搞混了,咋辦呢?4. docker綁定了nginx端口 外部訪問不到5. fragment - android webView 返回后怎么禁止重新渲染?6. docker不顯示端口映射呢?7. nignx - docker內nginx 80端口被占用8. php - mysql 模糊搜索問題9. docker images顯示的鏡像過多,狗眼被亮瞎了,怎么辦?10. php - 第三方支付平臺在很短時間內多次異步通知,訂單多次確認收款
排行榜
