1. Computing

Discuss in my forum

First Child Pseudo Selector

An Expansion of the CSS Child Selector

By , About.com Guide

Once you have defined a child selector you can refine that selection even further using the CSS pseudo-selector first child. This allows you to add cascading style sheet styles to an even more specific element within a page.

Defining the first child:
  div > p:first-child { background-color : #00f; }

This means that the first paragraph in a div element would have the background color of blue, but the rest would keep the default background color.

Browser Support

The first-child pseudo-selector is not supported in IE 6 and lower for Windows or Netscape 4 for Windows. It did work in Safari and Internet Explorer 5.2 for Macintosh.

©2013 About.com. All rights reserved.