CSS揭秘学习笔记
li.length == 4
li:first-child:nth-last-child(4), li:first-child:nth-last-child(4) ~ li { /* 当列表正好包含四项时,命中所有列表项 */ }
li.length >= 4
li:first-child:nth-last-child(n+4), li:first-child:nth-last-child(n+4) ~ li { /* 当列表至少包含四项时,命中所有列表项 */ }
li.length <=4
li:first-child:nth-last-child(-n+4), li:first-child:nth-last-child(-n+4) ~ li { /* 当列表最多包含四项时,命中所有列表项 */ }
时间: 2024-08-02 02:42:48