1. Home
  2. Computing & Technology
  3. Web Design / HTML

:first-child

By Jennifer Kyrnin, About.com

:first-child Description:

The :first-child pseudo-class matches an element that is the first child of another element.

:first-child Web Browser Support:

:first-child in CSS Versions:

:first-child Examples:

Select the paragraph tag that is the first child of a div

<style>
div > p:first-child { color: #f00; }
</style>

:first-child Special Notes:

  • Internet Explorer does not support this pseudo-class.

More :first-child Information:

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. CSS Pseudo Properties
  6. The :first-child Pseudo-Class - CSS 2 XHTML 1.0 HTML 4.0

©2008 About.com, a part of The New York Times Company.

All rights reserved.