Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS First- and last-of-type pseudo selectors. Reply To: First- and last-of-type pseudo selectors.

#257165
Paulie_D
Member

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.

https://codepen.io/Paulie-D/pen/WEQaYa

Otherwise it’s trying to select nth-of-class…which does not exist.