What's new? | Help | Directory | Sign in
Google
             
Search
for
Updated Sep 11, 2008 by pilgrim
Labels: about-css
FirstChildCSSPseudoClass  
The :first-child CSS pseudo-class matches any element that is the first child node of its parent.

Usage

<!-- HTML -->
<div>
    <p>This is the first child, and will have a green background</p>
    <p>Not the first child</p>
    <p>Not the first child</p>
</div>

/* CSS */
p:first-child {
    background: green;
}

Browser compatibility

Test IE8 IE7 FF3 FF2 Saf3 Opera9.5

Further reading


Sign in to add a comment