- 表示选择列表中的第一个标签。
p:first-child{}
- 表示选择列表中的最后一个标签。
p:last-child{}
- 表示选择列表中的第3个标签。
p:nth-child(3){}
- 表示选择列表中的奇数标签。
p:nth-child(2n-1){}
- 表示选择列表中的偶数标签。
p:nth-child(2n){}
- 表示选择列表中的标签从第3个开始到最后。
p:nth-child(n+3){}
- 表示选择列表中的标签从0到3。
p:nth-child(-n+3){}
- 表示选择列表中的倒数第3个标签。
p:nth-last-child(3){}
可以看出,只需要把n看出任何自然数就是我们选择的东西。