//例如有如下代码块
<div><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p>
</div>1.选择第n个p
div:nth-child(n)
p:nth-of-type(n)2.选择倒数第n个p
div:nth-last-child(n)
p:nth-last-of-type(n)3.选择偶数
div:nth-child(2n)
p:nth-of-type(2n)4.选择奇数
div:nth-child(2n - 1)
p:nth-of-type(2n - 1)5.选择前几个元素 例: 前4个p
div:nth-child(-n + 4)
p:nth-of-type(-n + 4)6.选择从第4个元素开始之后的元素
div:nth-child(n + 4)
p:nth-of-type(n + 4)7.选择第2-第5个元素
//5和6两者结合使用,可以限制选择某一个范围
div:nth-child(-n + 5):nth-child(n + 2)
p:nth-of-type(-n + 5):nth-of-type(n + 2)