but if you write p.test:last-of-type, only the last p with class test will be yellow. That’s what I mean by the last of type targets elements and not classes.
Not quite…although it might be the way it’s worded
p.test:last-of-type will only select an element if it is both the last one AND has a class of test.
Otherwise it’s trying to select
nth-of-class…which does not exist.