Description

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

Example

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

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

Get your free chapter of Level Up Your Web Apps with Go

Get a free chapter of Level Up Your Web Apps with Go, plus updates and exclusive offers from SitePoint.


No Reader comments

Related books & courses
Available now on SitePoint Premium

Preview for $1