Forums

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

Home Forums CSS Are div and div:nth-child(1) equivalent? Reply To: Are div and div:nth-child(1) equivalent?

#283198
Paulie_D
Member

With respect to Beverlyh this

div:nth-child(1) = the first div in a group of sibling div elements

Is not quite correct.

div:nth-child(1) = the first div which is also the first child of a parent.

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

For Beverleys exmaple to be true would need to be

div:nth-of-type(1) = the first div in a group of sibling div elements