:nth-child(n)与:nth-of-type(n)
:nth-child(n) 是选择父元素的第n个子元素。
:nth-of-type(n) 是选择父元素的第n个同类型的子元素
.read p:nth-child(2) 选择的是父元素.read第2个子元素,且是p元素。(先找第2个,再找是不是p)
.read p:nth-of-type(2) 则是选择父元素.read第2个为p的子元素。(先找p,再找第2个)
:nth-child(n) 是选择父元素的第n个子元素。
:nth-of-type(n) 是选择父元素的第n个同类型的子元素
.read p:nth-child(2) 选择的是父元素.read第2个子元素,且是p元素。(先找第2个,再找是不是p)
.read p:nth-of-type(2) 则是选择父元素.read第2个为p的子元素。(先找p,再找第2个)