:first-of-type (CSS selector)



This pseudo-class matches the first child element of the specified element type, and is equivalent to :nth-of-type.


This selector matches the first p element that’s a child of a div element:

div>p:first-of-type {
  ⋮ declarations

Learn HTML5 Online

Get all SitePoint books and courses with a Learnable membership. Start building future-proof websites that are faster, more powerful, and easier to maintain.

No Reader comments