E:first-child

Matches element E when E is the first child of its parent. (Source: W3C)

HTML:

  1. <p>Lorem ipsum dolor sit amet, consectetur</p>
  2. <p>Lorem ipsum dolor sit amet, consectetur</p>

CSS:

  1. p{font-style:normal}
  2. p:first-child{font-style:italic}

Output:

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

In the example, the first paragraph should be set in italics.