Pseudo-Class - :first-child

Pattern:

:first-child

 

Definition:

The :first-child pseudo-class matches the first child of some other element. Thus, ELEM:first-child will select any ELEM that is the first child of
another element.

 

Examples:

Style every img element that is the first child of a div element

div > img:first-child { background-color: lemonchiffon; }
w10schools
2014-11-13 10:13:47
Comments
Leave a Comment

Please login to continue.