h3
    黄色➜ p:nth-child(2)
     ➜ p:nth-of-type(2)

pspanspan2

p

p

h4

p

p

p

div

p

p

p

h5

p

p

p

selectorexampleexample description
:nth-child(n) p:nth-child(2) { background: #ff0000; } Specify a background color for every <p> element that is the second child of its parent:
:nth-of-type(n) p:nth-of-type(2) { background: #ff0000; } Specify a background color for every <p> element that is the second p element of its parent:

p

p

div

p

p

p

div

p

p

div

p

p

p

div 2

p

p

p

div
div 2

p

p

p

p

p

p

div 2

p

p

p