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.


In your example, you’re not applying the last-of-type selector to a specific class, instead you are applying it to last child p element of a given div with a specific class.


You should be able to accomplish what you are after… in fact you have the correct css for such in your demo. div.test2 p:last-of-type.

Just note that the last of type selector is being applied to the p element and not the div.