HTML and CSS Reference
In-Depth Information
Name
:first-child
Applies to:
Any element
Description:
Matches an element when it is the first child of another element. Thus,
div:first-child
will
select any
div
that is the first child of another element, notthe first child element of any
div
.
Examples:
td:first-child {border-left: 1px solid;}
p:first-child {text-indent: 0; margin-top: 2em;}