Menu Home

first-child

osbo.com | CSS | Pseudo-Classes | first-child

The first-child CSS pseudo-class represents an element that is the first child of its parent.

It is the same as :nth-child(1).

Syntax

selector:first-child {
    property: value;
}

Examples

Internal

first-of-type

last-child

last-of-type

nth-child

nth-last-child

nth-last-of-type

nth-of-type

only-child

only-of-type

External

World Wide Web Consortium (W3C)