關于selector:nth-child(n)的基礎知識:戳這里○○○
注意:只適合該父元素(div)下的子元素(p)不再包含子元素的情況,否則"孫子輩"的元素(span)也會被選中
<div>
<p>child A</p>
<p>child B</p>
<p>child C
<span>grandchild D</span>
<span>grandchild E</span>
</p>
</div>
比如,在css中寫p:nth-child(2)
時,會選中B和E